using System.Data.Entity;
比较值
DateTime comparedate = DateTime.Now;
//比较本年
int count = appservice.Where(q => SqlFunctions.DateDiff("year", t.CreateTime, date) == 0).Count();
//比较本月
int count = appservice.DbSet.Where(q => SqlFunctions.DateDiff("month", t.CreateTime, date) == 0).Count();
//本较是否为同一天
int count = appservice.DbSet.Where(q => SqlFunctions.DateDiff("day", t.CreateTime, date) == 0).Count();