Skip to content

Add EF.Functions.JsonContains for SQL Server 2025#37714

Open
roji wants to merge 1 commit intodotnet:mainfrom
roji:JsonContains2
Open

Add EF.Functions.JsonContains for SQL Server 2025#37714
roji wants to merge 1 commit intodotnet:mainfrom
roji:JsonContains2

Conversation

@roji
Copy link
Member

@roji roji commented Feb 15, 2026

Continues #37562

Closes #37566

@roji roji requested a review from a team as a code owner February 15, 2026 13:27
Copilot AI review requested due to automatic review settings February 15, 2026 13:27
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 exposes SQL Server 2025’s JSON_CONTAINS() via a new EF.Functions.JsonContains API, adds query translation for it, and updates/extends functional tests to validate the new translation against the native SQL Server json type behavior.

Changes:

  • Added SqlServerDbFunctionsExtensions.JsonContains(...) (marked [Experimental]) and wired up translation to JSON_CONTAINS in the SQL Server query translator.
  • Added new SQL Server translation tests for EF.Functions.JsonContains over scalar/complex/owned JSON properties and adjusted JSON string assertions to tolerate DB normalization.
  • Updated JSON-type update test baselines to reflect new parameter sizing behavior.

Reviewed changes

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

Show a summary per file
File Description
test/EFCore.SqlServer.FunctionalTests/Update/JsonUpdateJsonTypeSqlServerTest.cs Updates SQL baseline expectations for JSON-type parameter sizes.
test/EFCore.SqlServer.FunctionalTests/Query/Translations/JsonTranslationsSqlServerTest.cs Adds JsonContains translation tests and configures JsonString to use json type under SQL Server 2025+.
test/EFCore.Relational.Specification.Tests/Query/Translations/JsonTranslationsRelationalTestBase.cs Compares JSON strings via DOM to avoid failures due to DB JSON normalization.
src/Shared/EFDiagnostics.cs Adds a new diagnostic ID for the experimental JsonContains API.
src/EFCore.SqlServer/Query/Internal/SqlServerSqlTranslatingExpressionVisitor.cs Implements translation of EF.Functions.JsonContains to JSON_CONTAINS.
src/EFCore.SqlServer/Extensions/SqlServerDbFunctionsExtensions.cs Introduces the public EF.Functions.JsonContains API stub (experimental).

Copilot AI review requested due to automatic review settings February 15, 2026 20:03
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

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.

SQL Server: expose EF.Function.JsonContains()

2 participants