Linq中的规范函数对实体不起作用

Eva*_*kis 4 c# sql linq

试图在我的代码中运行此查询:

var rslt = ent.AppointmentDiaries.Where(s => s.DateTimeScheduled >=
                fromDate && EntityFunctions.AddMinutes(
                s.DateTimeScheduled, s.AppointmentLength) <= toDate);
Run Code Online (Sandbox Code Playgroud)

它不断分手:

An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code

Additional information: LINQ to Entities does not recognize the method 'System.Nullable`1[System.DateTime] AddMinutes(System.Nullable`1[System.DateTime], System.Nullable`1[System.Int32])' method, and this method cannot be translated into a store expression.
Run Code Online (Sandbox Code Playgroud)

使用entityframework 6.1.0 ...

我知道规范的连接,所以我希望EntityFunctions.AddMinutes能够使用codefirst查询......

知道我做错了什么吗?

Ger*_*old 6

在实体框架6中EntityFunctions已被替换DbFunctions.旧班级现在已标记为过时,将来会消失.

我必须承认,当谷歌发布发行说明时,这并不是很明显.然而,有一篇博客描述了如何 升级到EF6,其中提到了这种变化.