Improve preprocessor extensibility

未关闭
#39,418 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp
领域
databases

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

area-query needs-design

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:

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, and ProcessQueryRoots retain 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.
主要语言
C#
星标
14.8k
派生
3.5k
平均合并
3 天 7 小时
30 天内合并 PR
182

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dotnet/efcore 的其他 Issue

查看 dotnet/efcore 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。