試圖運行該查詢在我的代碼實體:規範功能在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'。 –
非常感謝。我們應該如何知道?爲什麼不刪除舊的* *困惑*。感謝隊友這工作得很好。你應該發佈它作爲答案,所以我可以給你一個讚許:) –