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: Introduce an Expression for query root #20146

Closed
Tracked by #18923
smitpatel opened this issue Mar 3, 2020 · 0 comments · Fixed by #20152, #20154 or #20165
Closed
Tracked by #18923

Query: Introduce an Expression for query root #20146

smitpatel opened this issue Mar 3, 2020 · 0 comments · Fixed by #20152, #20154 or #20165
Assignees
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@smitpatel
Copy link
Member

Currently we use ConstantExpression of EntityQueryable as query root.
EntityQueryable is an implementation of IQueryable which wraps current expression trees and allows it to be enumerated using IQueryProvider.

  • IQueryProvider is not needed during expression tree processing in anyway. It is a bootstrapper to execute query.
  • By introducing query root as expression we can streamline our implementation since we deal with ExpressionVisitors everywhere. (We pattern match constant of entity queryable everywhere
  • Allows derived query roots which can be visited by individual visitors also.

Split off from #18923

@smitpatel smitpatel self-assigned this Mar 3, 2020
@smitpatel smitpatel added this to the 5.0.0 milestone Mar 3, 2020
smitpatel added a commit that referenced this issue Mar 3, 2020
- Removed parenthesis around IPrintableExpression since it was making printing of query roots bad.
  - Individual expression should decide if it wants to add parenthesis around it.
- Reduce the expression tree before printing in Navigation expansion for more human readable form.

Required for #20146
smitpatel added a commit that referenced this issue Mar 3, 2020
- Removed parenthesis around IPrintableExpression since it was making printing of query roots bad.
  - Individual expression should decide if it wants to add parenthesis around it.
- Reduce the expression tree before printing in Navigation expansion for more human readable form.

Required for #20146
smitpatel added a commit that referenced this issue Mar 3, 2020
- Use expression for query roots rather tha constant of entity queryable
- Make it easy to access EntityType without need of any interface
- Make IAsyncQueryProvider public as it is part of QueryRootExpression
  - A query root contains both entity type and query provider so that multiple context cannot be used inside same query
- Update expression printing of DbSet to take care of shared type entity type
- Fix bug to compare query roots of shared type entity type more accurately
- Remove IEntityQueryable interface, detaching query provider happens on query root expression
- Remove IsEntityQueryable method as we no longer create constant expression of entity queryable

Part of #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids any specific processing in core provider
- Takes care of parameterization correctly
- Also improved parameter extraction by creating parameter for any expression outside of lambda even when not a method call argument

Part of #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids having to do special processing in other visitors
- Visit's method's argument correctly in other visitor (this means that if there is a navigation expansion required for a parameter it will be done automatically)
- Remove Nav expansion factory not needed anymore
- Rename ExpressionPrinter.VisitList to VisitCollection and take IReadOnlyCollection, that is what most expression uses.
- Remove unnecessary exception message. They are part of a larger work item.

Resolves #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids having to do special processing in other visitors
- Visit's method's argument correctly in other visitor (this means that if there is a navigation expansion required for a parameter it will be done automatically)
- Remove Nav expansion factory not needed anymore
- Rename ExpressionPrinter.VisitList to VisitCollection and take IReadOnlyCollection, that is what most expression uses.
- Remove unnecessary exception message. They are part of a larger work item.

Resolves #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids any specific processing in core provider
- Takes care of parameterization correctly
- Also improved parameter extraction by creating parameter for any expression outside of lambda even when not a method call argument

Part of #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids having to do special processing in other visitors
- Visit's method's argument correctly in other visitor (this means that if there is a navigation expansion required for a parameter it will be done automatically)
- Remove Nav expansion factory not needed anymore
- Rename ExpressionPrinter.VisitList to VisitCollection and take IReadOnlyCollection, that is what most expression uses.
- Remove unnecessary exception message. They are part of a larger work item.

Resolves #20146
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Mar 4, 2020
smitpatel added a commit that referenced this issue Mar 4, 2020
- Use expression for query roots rather tha constant of entity queryable
- Make it easy to access EntityType without need of any interface
- Make IAsyncQueryProvider public as it is part of QueryRootExpression
  - A query root contains both entity type and query provider so that multiple context cannot be used inside same query
- Update expression printing of DbSet to take care of shared type entity type
- Fix bug to compare query roots of shared type entity type more accurately
- Remove IEntityQueryable interface, detaching query provider happens on query root expression
- Remove IsEntityQueryable method as we no longer create constant expression of entity queryable

Part of #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids any specific processing in core provider
- Takes care of parameterization correctly
- Also improved parameter extraction by creating parameter for any expression outside of lambda even when not a method call argument

Part of #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids having to do special processing in other visitors
- Visit's method's argument correctly in other visitor (this means that if there is a navigation expansion required for a parameter it will be done automatically)
- Remove Nav expansion factory not needed anymore
- Rename ExpressionPrinter.VisitList to VisitCollection and take IReadOnlyCollection, that is what most expression uses.
- Remove unnecessary exception message. They are part of a larger work item.

Resolves #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Use expression for query roots rather tha constant of entity queryable
- Make it easy to access EntityType without need of any interface
- Make IAsyncQueryProvider public as it is part of QueryRootExpression
  - A query root contains both entity type and query provider so that multiple context cannot be used inside same query
- Update expression printing of DbSet to take care of shared type entity type
- Fix bug to compare query roots of shared type entity type more accurately
- Remove IEntityQueryable interface, detaching query provider happens on query root expression
- Remove IsEntityQueryable method as we no longer create constant expression of entity queryable

Part of #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids any specific processing in core provider
- Takes care of parameterization correctly
- Also improved parameter extraction by creating parameter for any expression outside of lambda even when not a method call argument

Part of #20146
smitpatel added a commit that referenced this issue Mar 4, 2020
- Avoids having to do special processing in other visitors
- Visit's method's argument correctly in other visitor (this means that if there is a navigation expansion required for a parameter it will be done automatically)
- Remove Nav expansion factory not needed anymore
- Rename ExpressionPrinter.VisitList to VisitCollection and take IReadOnlyCollection, that is what most expression uses.
- Remove unnecessary exception message. They are part of a larger work item.

Resolves #20146
@ajcvickers ajcvickers modified the milestones: 5.0.0, 5.0.0-preview3 Mar 31, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0-preview3, 5.0.0 Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
2 participants