LINQ to Entities 不识别方法“System.String ToShortDateString()因此该方法无法转换为存储表达式。

1、toTlist()后附加条件转换

db.TB_Log_SMS.ToList().Count(m => m.AddDate.ToShortDateString() == DateTime.Now.ToShortDateString();

2、EntityFunctions.TruncateTime()转换

db.TB_Log_SMS.Count(m =>EntityFunctions.TruncateTime( m.AddDate) == EntityFunctions.TruncateTime(DateTime.Now));

 

posted @ 2020-04-03 17:16  objnet  阅读(317)  评论(0编辑  收藏  举报