-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query: Property binding on the result entity from grouping.First #26753
Comments
Noting for my use case - pre-OrderBy worked ok (I guess that's a workaround of sorts). Count or Select Shaping specifically were the issues: |
I ran the query with OrderBy in release/6.0 branch and it failed for me with client eval error. Select also caused client eval error rather than a random exception. Please provide a runnable repro if you are seeing otherwise. |
I see why - it was getting applied before the GroupBy: |
Another use case of mine,
What I want to do,
So, My codes are like below, var result = await context.People
.Where(p => p.Age < 25)
.GroupBy(r => r.Country)
.Select(g => g
.OrderByDescending(p => p.Age)
.First())
.OrderByDescending(p => p.Age)
.Take(2)
.Select(p => new Person()
{
Id= p.Id,
Name=p.Name
})
.ToListAsync();
// .... But now EF Core throws |
@LeaFrock Generically - do as much as you can before the GroupBy and then anything that can't, client-side the effort after. Right off the bat I can see this after the GroupBy - that alone will throw the error you're getting: |
Query like
MyField is mapped property but in translation we see a shaped query on which we have to bind rather than entity reference so we fail to bind and throw error that OrderBy couldn't be translated. (Same goes for Select or any other operation which tries to bind property)
The text was updated successfully, but these errors were encountered: