Skip to content
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: Select.Include.OrderBy ignores the include #10101

Closed
smitpatel opened this issue Oct 17, 2017 · 6 comments
Closed

Query: Select.Include.OrderBy ignores the include #10101

smitpatel opened this issue Oct 17, 2017 · 6 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@smitpatel
Copy link
Member

                    var query2 = context.Set<OrderLine9912>()
                        .Select(o => o.Order)
                        .Include(o => o.Customer)
                        .OrderBy(o => o.Id)
                        .ToList();

If OrderBy is present, we ignore the include, if it is absent then we do include correctly

@maumar
Copy link
Contributor

maumar commented Feb 14, 2018

workaround is to apply Include after the order by

maumar added a commit that referenced this issue Feb 15, 2018
Problem was that in QueryOptimizer, if we flattened redundant subquery (Include result operator was the only element on that subquery and we strip those out) we did not update PathFromQuerySource on the IncludeResultOperator annotations with the new Qsre.
Also, in nav rewrite we were trying to match PathFromQuerySource with regular comparison, rather than using ExpressionComparer.
maumar added a commit that referenced this issue Feb 15, 2018
Problem was that in QueryOptimizer, if we flattened redundant subquery (Include result operator was the only element on that subquery and we strip those out) we did not update PathFromQuerySource on the IncludeResultOperator annotations with the new Qsre.
Also, in nav rewrite we were trying to match PathFromQuerySource with regular comparison, rather than using ExpressionComparer.
maumar added a commit that referenced this issue Feb 15, 2018
Problem was that in QueryOptimizer, if we flattened redundant subquery (Include result operator was the only element on that subquery and we strip those out) we did not update PathFromQuerySource on the IncludeResultOperator annotations with the new Qsre.
Also, in nav rewrite we were trying to match PathFromQuerySource with regular comparison, rather than using ExpressionComparer.
maumar added a commit that referenced this issue Feb 16, 2018
Problem was that in QueryOptimizer, if we flattened redundant subquery (Include result operator was the only element on that subquery and we strip those out) we did not update PathFromQuerySource on the IncludeResultOperator annotations with the new Qsre.
Also, in nav rewrite we were trying to match PathFromQuerySource with regular comparison, rather than using ExpressionComparer.
maumar added a commit that referenced this issue Feb 16, 2018
Problem was that in QueryOptimizer, if we flattened redundant subquery (Include result operator was the only element on that subquery and we strip those out) we did not update PathFromQuerySource on the IncludeResultOperator annotations with the new Qsre.
Also, in nav rewrite we were trying to match PathFromQuerySource with regular comparison, rather than using ExpressionComparer.
@maumar
Copy link
Contributor

maumar commented Feb 16, 2018

fixed by d527800

@maumar maumar closed this as completed Feb 16, 2018
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Feb 16, 2018
maumar added a commit that referenced this issue Feb 24, 2018
…ion projection doesn't work

Problem was that we were not properly updating PathFromQuerySource and QuerySource properties on IncludeResultOperator when processing SelectMany in nav rewrite. This issue is similar to #10101
maumar added a commit that referenced this issue Feb 24, 2018
…ion projection doesn't work

Problem was that we were not properly updating PathFromQuerySource and QuerySource properties on IncludeResultOperator when processing SelectMany in nav rewrite. This issue is similar to #10101
maumar added a commit that referenced this issue Feb 27, 2018
…ion projection doesn't work

Problem was that we were not properly updating PathFromQuerySource and QuerySource properties on IncludeResultOperator when processing SelectMany in nav rewrite. This issue is similar to #10101
@MarcelChirtes
Copy link

MarcelChirtes commented Apr 18, 2019

Something strange happens to me, at first run (request) warning is there, then everything is silent, EF core 2.2.3, contextLifetime and optionsLifetime are scoped, the warning reapers one time once app is restarted.

@ajcvickers
Copy link
Member

@MarcelChirtes This is expected. The query compiles once, at which time you see the warning, and is then cached for future calls.

@MarcelChirtes
Copy link

@ajcvickers fair point, I assume there's no way to suppress it? Thank you.

@ajcvickers
Copy link
Member

ajcvickers commented Apr 19, 2019

@MarcelChirtes Any warning can be suppressed using ConfigureWarnings in the DbContextOptionsBuilder provided by AddDbContext or OnConfiguring.

@ajcvickers ajcvickers modified the milestones: 2.1.0-preview2, 2.1.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

4 participants