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

出现这个错误提示可以用 DbFunctions.TruncateTime 将Linq中entity的DateTime转化一下再使用,如下所示:

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

更多详细解答请看如下链接:

http://stackoverflow.com/questions/14601676/the-specified-type-member-date-is-not-supported-in-linq-to-entities-only-init 

Date vs DateTime

http://stackoverflow.com/questions/798121/date-vs-datetime 

原文地址:https://www.cnblogs.com/mingmingruyuedlut/p/4965129.html