-
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
Include() does not work if used after Union() #16065
Comments
related to #6812 |
Notes from triage: We plan to implement this in 3.0, but consider:
var list = ctx.Bars.Include(b => b.Foo)
.Union(ctx.Bars.Include(b => b.Foo))
.ToList(); But this will throw: var list = ctx.Bars.Include(b => b.Foo)
.Union(ctx.Bars)
.ToList();
var list = ctx.Bars
.Include(b => b.Foo)
.Union(ctx.Bars)
.ToList(); is different from this: var list = ctx.Bars
.Union(ctx.Bars)
.Include(b => b.Foo)
.ToList(); Assigning to @roji |
@maumar @ajcvickers Thanks for clarification. It's a fair distinction and in makes sense this does not work with the current in-memory implementation of Union (if maybe surprising for new users coming from EF6). |
* Include/nav rewriting is now supported. * We now push down to subquery when OrderBy, Take or Skip are applied to set operations, to avoid using the hack where ColumnExpression with no table alias was used. dotnet#16244 was opened to track for post-3.0. * Added missing support for union over subselect projection mappings. * Added Other type to SetOperationType so that providers can define extra set operations (e.g. PostgreSQL `INTERSECT ALL`, `EXCEPT ALL`). Completes dotnet#6812 Fixes dotnet#13196 Fixes dotnet#16065 Fixes dotnet#16165
* Include/nav rewriting is now supported. * We now push down to subquery when OrderBy, Take or Skip are applied to set operations, to avoid using the hack where ColumnExpression with no table alias was used. #16244 was opened to track for post-3.0. * Added missing support for union over subselect projection mappings. * Added Other type to SetOperationType so that providers can define extra set operations (e.g. PostgreSQL `INTERSECT ALL`, `EXCEPT ALL`). Completes #6812 Fixes #13196 Fixes #16065 Fixes #16165
This works in the new implementation, see test Union_Include introduced in #16249. |
* Include/nav rewriting is now supported. * We now push down to subquery when OrderBy, Take or Skip are applied to set operations, to avoid using the hack where ColumnExpression with no table alias was used. dotnet#16244 was opened to track for post-3.0. * Added missing support for union over subselect projection mappings. * Added Other type to SetOperationType so that providers can define extra set operations (e.g. PostgreSQL `INTERSECT ALL`, `EXCEPT ALL`). Completes dotnet#6812 Fixes dotnet#13196 Fixes dotnet#16065 Fixes dotnet#16165
* Include/nav rewriting is now supported. * We now push down to subquery when OrderBy, Take or Skip are applied to set operations, to avoid using the hack where ColumnExpression with no table alias was used. dotnet#16244 was opened to track for post-3.0. * Added missing support for union over subselect projection mappings. * Added Other type to SetOperationType so that providers can define extra set operations (e.g. PostgreSQL `INTERSECT ALL`, `EXCEPT ALL`). Completes dotnet#6812 Fixes dotnet#13196 Fixes dotnet#16065 Fixes dotnet#16165
* Include/nav rewriting is now supported. * We now push down to subquery when OrderBy, Take or Skip are applied to set operations, to avoid using the hack where ColumnExpression with no table alias was used. #16244 was opened to track for post-3.0. * Added missing support for union over subselect projection mappings. * Added Other type to SetOperationType so that providers can define extra set operations (e.g. PostgreSQL `INTERSECT ALL`, `EXCEPT ALL`). Completes #6812 Fixes #13196 Fixes #16065 Fixes #16165
* Include/nav rewriting is now supported. * We now push down to subquery when OrderBy, Take or Skip are applied to set operations, to avoid using the hack where ColumnExpression with no table alias was used. dotnet#16244 was opened to track for post-3.0. * Added missing support for union over subselect projection mappings. * Added Other type to SetOperationType so that providers can define extra set operations (e.g. PostgreSQL `INTERSECT ALL`, `EXCEPT ALL`). Completes dotnet#6812 Fixes dotnet#13196 Fixes dotnet#16065 Fixes dotnet#16165
* Include/nav rewriting is now supported. * We now push down to subquery when OrderBy, Take or Skip are applied to set operations, to avoid using the hack where ColumnExpression with no table alias was used. #16244 was opened to track for post-3.0. * Added missing support for union over subselect projection mappings. * Added Other type to SetOperationType so that providers can define extra set operations (e.g. PostgreSQL `INTERSECT ALL`, `EXCEPT ALL`). Completes #6812 Fixes #13196 Fixes #16065 Fixes #16165
* Include/nav rewriting is now supported. * We now push down to subquery when OrderBy, Take or Skip are applied to set operations, to avoid using the hack where ColumnExpression with no table alias was used. #16244 was opened to track for post-3.0. * Added missing support for union over subselect projection mappings. * Added Other type to SetOperationType so that providers can define extra set operations (e.g. PostgreSQL `INTERSECT ALL`, `EXCEPT ALL`). Completes #6812 Fixes #13196 Fixes #16065 Fixes #16165
I have the following data context:
With this setup, I'm not able to use
Include
after I appliedUnion
:This will work if
Include()
is used beforeUnion()
, but this workaround is less than ideal, when I want the queryable to be reusable and only care about fetching the association in specific cases.Further technical details
EF Core version: 2.2.4
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.9.3
The text was updated successfully, but these errors were encountered: