试图在我的代码中运行此查询:
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查询......
知道我做错了什么吗?