我的.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);
}
Run Code Online (Sandbox Code Playgroud)
当我在ASP .NET CORE中使用它时,我不能使用DbFunctions.我如何重写它以使其在Microsoft.EntityFrameworkCore中工作?我正在使用SQLite,如果这有所作为.