var all = db.Content.Where(c => c.UserId == userId && DbFunctions.DiffDays(c.CreateDate,toDate)==0).DefaultIfEmpty().Count();
主要是使用了:
DbFunctions.DiffDays
EF获取当天的数据集合
原文:https://www.cnblogs.com/firstcsharp/p/11725566.html