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 custom query root expression #20152

Merged
merged 4 commits into from
Mar 4, 2020
Merged

Conversation

smitpatel
Copy link
Member

@smitpatel smitpatel commented 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


Query: Allow creating query roots without provider
When entity queryables are injected while compiling a query, they don't need query provider
External queries only need query provider to make sure that we are using DbSets from same context

@smitpatel smitpatel linked an issue Mar 4, 2020 that may be closed by this pull request
- 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
When entity queryables are injected while compiling a query, they don't need query provider
External queries only need query provider to make sure that we are using DbSets from same context
- 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
- 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
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.

Query: Introduce an Expression for query root
2 participants