How do I use this class extension inside my LINQ query. I get the error:
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}"
});
The method I am using: https://stackoverflow.com/a/1379158/6157660