Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Dec 15, 2025

Fixes #37370

@roji roji force-pushed the CompiledQueriesUncorrelatedCollections branch 2 times, most recently from 9fe65de to 604c7dd Compare December 15, 2025 11:27
@roji roji marked this pull request as ready for review December 15, 2025 11:27
@roji roji requested a review from a team as a code owner December 15, 2025 11:27
@roji
Copy link
Member Author

roji commented Dec 15, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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 fixes issue #37370 by properly handling uncorrelated parameterized collections in compiled queries. When a parameter collection is used in a query without any operation that provides type inference (e.g., comparison to a column), the code now falls back to applying the default type mapping instead of failing.

Key changes:

  • Modified type mapping postprocessors to handle collections without inferred type mappings by applying default mappings
  • Added test coverage for compiled queries with uncorrelated parameter collection expressions across all database providers

Reviewed changes

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

Show a summary per file
File Description
src/EFCore.Relational/Query/RelationalTypeMappingPostprocessor.cs Added fallback logic to apply default type mapping when no inferred element type mapping exists for VALUES expressions
src/EFCore.SqlServer/Query/Internal/SqlServerTypeMappingPostprocessor.cs Added fallback logic to apply default type mapping when no inferred element type mapping exists for OPENJSON expressions
test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs Added base test for compiled queries with uncorrelated parameter collection expressions
test/EFCore.Sqlite.FunctionalTests/Query/PrimitiveCollectionsQuerySqliteTest.cs Added SQLite-specific test override with SQL assertion
test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs Added SQL Server-specific test override with SQL assertion
test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerJsonTypeTest.cs Added SQL Server JSON type-specific test override with SQL assertion
test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServer160Test.cs Added SQL Server 2016-specific test override with SQL assertion
test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQueryOldSqlServerTest.cs Added older SQL Server version-specific test override with SQL assertion
test/EFCore.Cosmos.FunctionalTests/Query/PrimitiveCollectionsQueryCosmosTest.cs Added Cosmos DB-specific test override with SQL assertion

@roji roji force-pushed the CompiledQueriesUncorrelatedCollections branch from 604c7dd to 47f4138 Compare December 27, 2025 08:39
@roji
Copy link
Member Author

roji commented Dec 27, 2025

Test failures unrelated, merging.

@roji roji merged commit 767ce8e into dotnet:main Dec 27, 2025
5 of 7 checks passed
@roji roji deleted the CompiledQueriesUncorrelatedCollections branch December 27, 2025 10:17
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.

Compiled queries fail with uncorrelated parameterized collections

2 participants