LINQクエリでこのクラス拡張を使用するにはどうすればよいですか。 私はエラーを取得する:LINQクエリの内部でこのクラス拡張を使用するにはどうすればよいですか?
Method 'System.DateTime AddBusinessDays(System.DateTime, Int32)' has no supported translation to SQL.
var CProcess = (from m in DataContext.csrcallds
let scheddt = FluentDateTime.DateTimeExtensions.AddBusinessDays((DateTime)m.scheduledon, 2)
where m.scheduledon >= earliestDate
&& m.scheduledon <= objdate1.DateStart
&& m.calltype == "CHQRUN"
&& (SqlMethods.DateDiffDay(scheddt, m.completedon) > 2)
group m by new { m.scheduledon.Value.Year, m.scheduledon.Value.Month } into p
orderby p.Key.Year ascending, p.Key.Month ascending
select new Date1()
{
theDate = DateTime.Parse($"{p.Key.Month} - {p.Key.Year}"),
theCount = p.Count(),
theString = $"{p.Key.Month} - {p.Key.Year}"
});
私が使用しています方法: https://stackoverflow.com/a/1379158/6157660
あなたは 'AddBusinessDays'拡張メソッドのコードを表示できますか?つまり、メソッドの内容をlinqクエリに直接追加する必要があります。メソッドのコードに応じて、[LinqKit](http://www.albahari.com/nutshell/linqkit.aspx)がオプションになる可能性があります。 – Maarten
@Maarten http://stackoverflow.com/a/1379158/6157660 –
@GiladGreen SQLユーザー定義関数を呼び出す予定はありません。 –