Skip to content

Remove SqlExpressionVisitor from Cosmos#37927

Open
roji wants to merge 2 commits intodotnet:mainfrom
roji:RemoveSqlExpressionVisitor
Open

Remove SqlExpressionVisitor from Cosmos#37927
roji wants to merge 2 commits intodotnet:mainfrom
roji:RemoveSqlExpressionVisitor

Conversation

@roji
Copy link
Member

@roji roji commented Mar 14, 2026

Cleanup, continues #37533

@roji roji requested a review from a team as a code owner March 14, 2026 17:17
Copilot AI review requested due to automatic review settings March 14, 2026 17:17
@roji roji enabled auto-merge (squash) March 14, 2026 17:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Continues the cleanup from #37533 by removing the SqlExpressionVisitor base class from the Cosmos provider, inlining its VisitExtension dispatch logic directly into CosmosQuerySqlGenerator.

Changes:

  • Deleted SqlExpressionVisitor.cs and changed CosmosQuerySqlGenerator to inherit from ExpressionVisitor directly
  • Inlined the expression type dispatch switch into CosmosQuerySqlGenerator.VisitExtension, throwing with a descriptive error for unhandled expressions
  • Changed all Visit* methods from protected override to protected virtual, and added a new UnhandledExpressionInVisitor resource string

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
SqlExpressionVisitor.cs Deleted — base class no longer needed
CosmosQuerySqlGenerator.cs Now extends ExpressionVisitor; inlines dispatch switch; methods become virtual
CosmosStrings.resx Added UnhandledExpressionInVisitor resource string
CosmosStrings.Designer.cs Auto-generated accessor for the new resource string (has a duplicate summary bug)
Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Language not supported

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 15, 2026 07:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the SqlExpressionVisitor base class from the Cosmos provider, continuing the cleanup started in #37533 for the relational provider. The VisitExtension dispatch logic is inlined directly into CosmosQuerySqlGenerator, and unhandled expressions now throw with a descriptive error message.

Changes:

  • Deleted SqlExpressionVisitor.cs and moved its dispatch switch into CosmosQuerySqlGenerator.VisitExtension
  • Changed all Visit* methods from protected override to protected virtual and sealed override to protected virtual
  • Added UnhandledExpressionInVisitor error string resource for Cosmos

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
SqlExpressionVisitor.cs Deleted abstract visitor base class
CosmosQuerySqlGenerator.cs Inlined VisitExtension dispatch; changed method modifiers from override/sealed override to virtual
CosmosStrings.resx Added UnhandledExpressionInVisitor resource string
CosmosStrings.Designer.cs Generated accessor for the new resource string
Files not reviewed (1)
  • src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs: Language not supported

You can also share your feedback on Copilot code review. Take the survey.

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.

3 participants