This should be an EF Core issue.
Starting with EF Core 3.x, EF no longer evaluates LINQ queries on the client side. You can see this change in the documentation.
Breaking changes included in EF Core 3.x
The easiest way to modify should be to follow the prompts of the exception information, use AsEnumerable() or ToList() to transfer the query to the local instead of the database side.
//Wrong way
var BestproductSale = model.ScoreTables
.GroupBy(x => x.Math)
.Select(grp => new
{
number = grp.Key,
product = grp.ToList().FirstOrDefault().Name
})
.OrderByDescending(x => x.number).ToList();
//Right way
var BestproductSale = model.ScoreTables.ToList()
.GroupBy(x => x.Math)
.Select(grp => new
{
number = grp.Key,
product = grp.ToList().FirstOrDefault().Name
})
.OrderByDescending(x => x.number).ToList();
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.