Query: Stop producing N+1 queries for cases where single element subquery is projected inside a DTO #7882
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
As a consequence of fixing issue #7714 we are now producing N+1 queries for cases like:
customers.Select(c => new DTO { Count = c.Orders.Count() })
This is not necessary, because, even though parent query model needs client projection (because DTO is being used), the subquery returns a single result. We need to pass additional information to SqlTranslatingExpressionVisitor, so that it knows that the subquery that its currently processing returns a single result and that i can actually be fully translated into the parent query (unless something else forces client evaluation)
The text was updated successfully, but these errors were encountered: