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

Fix to #15264 - QueryRewrite: incorporate query filters into nav rewrite #17021

Merged
merged 1 commit into from
Aug 9, 2019

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Aug 8, 2019

When nav rewrite constructs new EntityQueryable it now looks into EntityType for any query filter annotations and applies them on top. Those predicates are parameterized and the parameters created are injected into the context as part of query execution expression.
Generated predicate expression is re-visited by nav expansion to recursively handle filters (expand potential navigation expansions that were introduced in them).

This adds some complexity to the way navigations are expanded - before the newly constructed join always was guaranteed to be an entity. Now it can be a complex structure with multiple navigations already expanded.

@maumar maumar force-pushed the fix15264 branch 2 times, most recently from 89eb843 to 246be4c Compare August 9, 2019 00:18
@maumar maumar requested a review from ajcvickers August 9, 2019 00:18
@maumar
Copy link
Contributor Author

maumar commented Aug 9, 2019

new version up, still a couple outstanding issues/nitpicks left.

@maumar maumar force-pushed the fix15264 branch 2 times, most recently from e3c80c1 to bb5a176 Compare August 9, 2019 21:36
@smitpatel
Copy link
Contributor

            case ExpressionType.AndAlso:

You can do in separate PR. Change this switch case to do pattern match on type rather than node type. It will simplify it a lot.


Refers to: src/EFCore/Query/ExpressionPrinter.cs:193 in bb5a176. [](commit_id = bb5a176, deletion_comment = False)

expressionPrinter.StringBuilder.Append("Source: ");
expressionPrinter.Visit(Source);
expressionPrinter.StringBuilder.AppendLine();
expressionPrinter.StringBuilder.Append("PendingSelector: ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also print pending orderings

Copy link
Contributor

@smitpatel smitpatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

When nav rewrite constructs new EntityQueryable it now looks into EntityType for any query filter annotations and applies them on top. Those predicates are parameterized and the parameters created are injected into the context as part of query execution expression.
Generated predicate expression is re-visited by nav expansion to recursively handle filters (expand potential navigation expansions that were introduced in them).

This adds some complexity to the way navigations are expanded - before the newly constructed join always was guaranteed to be an entity. Now it can be a complex structure with multiple navigations already expanded.

Also small cleanup on ExpressionPrinter - adding IPrintable to some of the custom nodes created by nav expansion and removing rendering of connecting lines when printing the expression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants