Extracting subquery to a variable causes local evaluation #4857
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
Sorry for the contrived query, it's a simplified example that still reproduces the problem.
If I run this code, it works fine:
The generated SQL looks good:
But if I modify that code to pull the subquery out into a variable...
Then EF decides that it "could not be translated and will be evaluated locally":
And it repeatedly executes the following query, over and over:
The number of times it executes matches the number of rows in the
Asset
table.Generally speaking, I would have expected any EF IQueryable variable used within a query to be automatically "inlined", if that makes sense, and produce the same SQL as if it had been written as a single LINQ statement?
7.0.0-rc1-final. Windows 10, VS 2015 LocalDB
The text was updated successfully, but these errors were encountered: