Merged
Conversation
fe29056 to
c8630b3
Compare
There was a problem hiding this comment.
Pull request overview
This PR removes the intermediate SqlExpressionVisitor base class and refactors QuerySqlGenerator to inherit directly from ExpressionVisitor. The purpose is to simplify the codebase since SqlExpressionVisitor was only used by QuerySqlGenerator and didn't provide significant value.
Changes:
- Deleted
SqlExpressionVisitor.csentirely (315 lines) - Refactored
QuerySqlGeneratorto inherit fromExpressionVisitorinstead ofSqlExpressionVisitor, moved the switch-basedVisitExtensionlogic directly into the class, and converted to primary constructor syntax - Changed all Visit method signatures from
protected overridetoprotected virtualand madeVisitLike,VisitExists, andVisitInprivate since they no longer need to be overridable
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/EFCore.Relational/Query/SqlExpressionVisitor.cs | Complete removal of the intermediate visitor base class |
| src/EFCore.Relational/Query/QuerySqlGenerator.cs | Refactored to inherit directly from ExpressionVisitor, moved VisitExtension logic inline, converted to primary constructor, changed method signatures appropriately, and removed obsolete method |
AndriySvyryd
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleanup/refactor. We currently have SqlExpressionVisitor, whose purpose was to be a visitor base type that forces every kind of SQL expression to be explicitly handled by a visitor. However, this type is only used by QuerySqlGenerator, and there are simpler ways to make sure all expression types are handled (e.g. simply throw for unhandled expressions in VisitExtension). Since this base type adds no real value, this removes it.
Also cleans up some minor things in QuerySqlGenerator. Technically contains provider-facing breaking changes, but these are extremely unlikely to affect anyone in practice.