,我有以下功能LINQ在我的.net應用程序中DbFunctions.TruncateTime LINQ相當於ASP .NET CORE
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);
}
當我使用這個在ASP .NET CORE,我不能使用DbFunctions。我怎樣才能重寫這個在Microsoft.EntityFrameworkCore中工作?如果這有所作爲,我正在使用SQLite。
+100提供跟蹤鏈接!現在我看到.NET 2.0的核心有EF.Functions。 –