Skip to content

Simpler null constant checks in relational translator#37617

Merged
roji merged 3 commits into
dotnet:mainfrom
ShadyNagy:patch-1
Feb 3, 2026
Merged

Simpler null constant checks in relational translator#37617
roji merged 3 commits into
dotnet:mainfrom
ShadyNagy:patch-1

Conversation

@ShadyNagy
Copy link
Copy Markdown
Contributor

This PR simplifies internal null-constant checks in the relational query expression visitor by inlining pattern matching instead of using a small private helper method. The behavior is preserved while slightly reducing indirection.

Changes

  • In RelationalSqlTranslatingExpressionVisitor, inline the IsNullSqlConstantExpression helper logic into the entity-equality rewrite path and delete the now-unneeded private helper.
File Description
src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.StructuralEquality.cs Inlines null-constant detection for entity-equality rewrites using is SqlConstantExpression { Value: null } pattern matching and removes the redundant private helper.

Removed the IsNullSqlConstantExpression method that checks for null SQL constant expressions.
Remove IsNullSqlConstantExpression method
@ShadyNagy ShadyNagy requested a review from a team as a code owner February 3, 2026 08:09
@roji
Copy link
Copy Markdown
Member

roji commented Feb 3, 2026

@ShadyNagy rather than submitting multiple PRs (as in #37616), can you please do everything in one (this one)?

@ShadyNagy
Copy link
Copy Markdown
Contributor Author

@roji
This is the last one. I've checked the entire system and there are no more remaining.

@ShadyNagy rather than submitting multiple PRs (as in #37616), can you please do everything in one (this one)?

Copy link
Copy Markdown
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Thanks for your help!

@roji roji merged commit f84e31e into dotnet:main Feb 3, 2026
6 of 10 checks passed
@ShadyNagy ShadyNagy deleted the patch-1 branch February 3, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants