Improve preprocessor extensibility
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start with QueryTranslationPreprocessor.Process and compare the relational and Cosmos preprocessors named in the issue to trace the existing phase order and query-root specialization. Then read the provider API conventions and relevant preprocessing tests; done means phase ordering, override tree shapes, existing overrides, and default behavior are covered by tests, with provider-facing documentation for each supported boundary.
Written by the indexing model from the issue text.
Description
Database providers can already supply an IQueryTranslationPreprocessorFactory, derive from QueryTranslationPreprocessor or RelationalQueryTranslationPreprocessor, and override Process. There are also narrower extension points such as NormalizeQueryableMethod and ProcessQueryRoots. This issue is about improving that existing provider extension model, not introducing query interception.
Most preprocessing steps are nevertheless constructed and invoked directly inside QueryTranslationPreprocessor.Process. A provider can easily add work before or after the entire base implementation, but inserting or replacing a transformation between the remaining steps can require copying the base implementation and depending on internal visitors.
For example, a provider that needs to transform the navigation-expanded tree before the common query optimizations cannot currently override that individual phase. Copying Process makes the provider responsible for preserving the ordering of normalization, null-check removal, navigation expansion, and optimization, and for incorporating future changes to that sequence.
Current implementation:
- QueryTranslationPreprocessor
- RelationalQueryTranslationPreprocessor
- CosmosQueryTranslationPreprocessor, which already specializes query-root processing
Describe the solution you'd like
Expose narrowly scoped, overridable preprocessing phases where database providers need to customize the pipeline, while keeping the common sequencing and required transformations in the base implementation.
The precise API needs design. Prefer protected virtual phase methods and reuse of existing factories/dependencies over requiring providers to copy Process or introducing a general-purpose visitor-registration framework. Document the expression shape and invariants at each supported extension point, especially around normalization and navigation expansion.
Acceptance criteria
- A derived provider preprocessor can insert a transformation at a supported intermediate boundary, such as after navigation expansion and before common optimization, without reproducing the base processing sequence.
- A provider can specialize a supported phase while reusing the common behavior of that phase where appropriate.
- Existing overrides of
Process,NormalizeQueryableMethod, andProcessQueryRootsretain their behavior. - Core and relational preprocessors compose correctly; existing Cosmos and relational query-root specialization remains intact.
- Tests verify phase ordering, the tree shape visible to overrides, and unchanged behavior when no provider customization is supplied.
- Provider-facing API documentation describes the supported boundaries and required invariants. Newly exposed provider APIs follow the repository's provider API conventions.
Scope and related work
- This is a database-provider extension surface, not an application interceptor or an additive third-party plugin API.
- This does not request a hook before parameter extraction or funcletization.
- #28505 implemented LINQ expression interception; that is not a substitute for provider customization of intermediate preprocessing phases.
- #19748 concerns interception of SQL generation and is separate from this request.
- Combining visitors to reduce traversals is a separate performance task.
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.5k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 182
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/efcore
-
customer-reported
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
GroupBy element `OrderBy(...).First()`/`MaxBy` over an owned type mapped to its own table fails to translatePossibly taken @cincuranet claimed this today. Openarea-groupby area-query
Difficulty 4/5 3-5 days Newbie friendliness 25/100
dotnet/efcore#39833 · 1 assignee ·
Maintainers usually reply within 2 days
-
SQLite: Polygon.Length translates to GLength, which returns 0Possibly taken @cincuranet claimed this today. Openarea-query area-sqlite
Difficulty 3/5 1-2 days Newbie friendliness 45/100
dotnet/efcore#39826 · 1 assignee ·
Maintainers usually reply within 2 days
-
Migration lock with LockReleaseBehavior.Transaction doesn't prevent concurrent migrations since per-migration transactionsPossibly taken @AndriySvyryd claimed this 1 day ago. Openarea-migrations
dotnet/efcore#39824 · 1 assignee ·
Maintainers usually reply within 2 days
-
Querying a TPC base type with a JSON complex property throwsPossibly taken @cincuranet claimed this 1 day ago. Openarea-query
Difficulty 4/5 3-5 days Newbie friendliness 22/100
dotnet/efcore#39814 · 1 assignee ·
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SubtitleEdit/subtitleedit#17247 ·
Maintainers usually reply within 1 day
-
Restore test cleanup fails on Windows when restored files are read-onlyPossibly taken @JamBalaya56562 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
duplicati/duplicati#8046 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Bundles Documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pyrevitlabs/pyRevit#4285 ·
Maintainers usually reply within 1 day