The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties

后端 未结 10 2100
再見小時候
再見小時候 2020-11-28 02:47

Using this code in Entity Framework I receive the following error. I need to get all the rows for a specific date, DateTimeStart is of type Dat

10条回答
  •  渐次进展
    2020-11-28 03:26

    You should now use DbFunctions.TruncateTime

    var anyCalls = _db.CallLogs.Where(r => DbFunctions.TruncateTime(r.DateTime) == callDateTime.Date).ToList();
    

提交回复
热议问题