我在我的 .net 应用程序中有以下正常工作的LINQ
public ActionResult Index()
{
Dictionary<DateTime?, List<Event>> result;
result = (from events in db.Events.Include("Activity")
where events.IsActive
group events by DbFunctions.TruncateTime(events.DateTimeFrom) into dateGroup
select new { EventDate = dateGroup.Key, Events = dateGroup.ToList() }).ToDictionary(x => x.EventDate, x => x.Events);
return View(result);
}
当我在EF Core中使用时,我无法使用DbFunctions。 我该如何重写代码以使它在Microsoft.EntityFrameworkCore中正常工作?如果有差异,我正在使用SQLite。