-
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
Translation error for query with Distinct on collection #23897
Comments
|
The reason to use |
@MBashov I tried some approaches to perform a query using 'distinct' statement with ef core 5, but they all failed. Then I changed my mind and got another idea. You can use var result = db.Ones
.Select(o => new
{
threes = o.Twos!.Select(t => t.Three.Id).ToHashSet().AsEnumerable(),
})
.ToList(); Update: In fact the call to ToHashSet() is client evaluation, you can only use it in the last select statement. |
related to #22049 |
The following code throws
InvalidOperationException
on EF Core 5.0.2The query is translated correctly by EF Core 3.1:
The text was updated successfully, but these errors were encountered: