试图运行该查询在我的代码实体:规范功能在LINQ to不工作
var rslt = ent.AppointmentDiaries.Where(s => s.DateTimeScheduled >=
fromDate && EntityFunctions.AddMinutes(
s.DateTimeScheduled, s.AppointmentLength) <= toDate);
它保持分手:
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.
使用的EntityFramework 6.1.0
...
我知道关于canonical gunctions,所以我希望EntityFunctions.AddMinutes与codefirst查询一起工作...
任何想法我做错了什么?
'EntityFunctions'已成为'DbFunctions'。 –
非常感谢。我们应该如何知道?为什么不删除旧的* *困惑*。感谢队友这工作得很好。你应该发布它作为答案,所以我可以给你一个赞许:) –