I'm using the LinkqKit library and getting an error when I try to translate this code:
public static Expression<Func<Unit, int>> CalculateTimer()
{
return x => x.Statuses.Sum(s => EF.Functions.DateDiffDay(x.CreatedAt, DateTime.UtcNow));
}
The error says
Translation of method 'Microsoft.EntityFrameworkCore.SqlServerDbFunctionsExtensions.DateDiffDay' failed
Hovewer without Sum it works just fine
public static Expression<Func<Unit, int>> CalculateTimer()
{
return x => EF.Functions.DateDiffDay(x.CreatedAt, DateTime.UtcNow);
}
Also it works just fine (with Sum) when not using LinkqKit