Group By Is Being Translated Locally? How to Fix this?

c# entity-framework entity-framework-core group-by

Popular Answer

In your anonymous type, try adding named properties..GroupBy(x => new { CreatedDate = x.CreatedDate.Date, x.EmployeeId }) . I believe it is unable to locate and convert theDate if your real database column name is property name to DB table column nameCreatedDate .

var groupedEvents = dbContext.EventTrackings
    .Where(x => // where clause )
    .GroupBy(x => new { CreatedDate = x.CreatedDate.Date, x.EmployeeId })
    .OrderBy(x => x.Key.CreatedDate)
    .ToList();
0
1/8/2020 7:28:37 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow