I upgraded efcore 2.2 to 5 and simple group by is not working,
the data is already in memory, take a look:
List<IGrouping<Categories, Businesses>> businessesByCategory =
location.Businesses
.GroupBy(x => x.Category.Parent ?? x.Category)
.ToList();
In Ef Core 2.2 it worked fine, the businesses were grouped by their category, now it does nothing.
If I try to group by id it works:
List<IGrouping<int, Businesses>> businessesByCategory = location.Businesses
.GroupBy(x => x.Category.ParentId ?? x.CategoryId)
.ToList();
But I need the Category entity and this way I get only the category id.
GroupBy
so all the data was loaded on the client and grouped there, without any benefit from indexing. Client-side evaluation was an ugly stop gap measure that was going to be removed. EF Core 2.2. could handle GroupBy but still allowed client side evaluation with warnings. If you checked your application's logs you'd see client-side evaluation warnings. EF Core 3.0 finally disabled client-side evaluationGroupBy
operation? If yes, probably you have loaded the objects using no tracking query?