Implement EF.MultipleParameters method.#36358
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for the new EF.MultipleParameters query method by extending the core query pipeline, expression visitors, and SQL generation, and updates tests to exercise the new parameterization modes.
- Add a
ParameterExpressionModeenum and thread it throughQueryParameterExpression, normalization, funcletization, and SQL translation. - Extend relational and SQL Server nullability and in‐memory processors to handle multiple parameter expansions.
- Update relational, SQL Server, SQLite, and Cosmos tests to parameterize collection tests over
ParameterizedCollectionModeand add newEF.MultipleParameterstests.
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/EFCore/Query/QueryParameterExpression.cs | Replace boolean flags with ParameterExpressionMode property. |
| src/EFCore/Query/Internal/QueryableMethodNormalizingExpressionVisitor.cs | Normalize EF.MultipleParameters calls into QueryParameterExpression with the new mode. |
| src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs | Throw appropriate generic error for non-evaluatable EF.MultipleParameters<T>. |
| src/EFCore.Relational/Query/SqlNullabilityProcessor.cs | Handle multiple parameter expansion based on ParameterExpressionMode. |
| src/EFCore.Relational/Query/SqlExpressions/SqlParameterExpression.cs | Replace ShouldBeConstantized with ParameterExpressionMode. |
| src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs | Apply new mode flags when generating IN and JSON queries. |
| src/EFCore.Relational/Query/Internal/RelationalParameterProcessor.cs | Thread ParameterExpressionMode through parameter processing. |
| src/EFCore/Properties/CoreStrings.resx | Consolidate EF.Constant/EF.Parameter error messages into generic template. |
| test/.../NonSharedPrimitiveCollections* | Convert collection tests to theories over ParameterizedCollectionMode. |
| test/.../NorthwindWhereQuery* | Add EF_MultipleParameters_with_non_evaluatable_argument_throws tests for relational and provider-specific projects. |
Files not reviewed (1)
- src/EFCore/Properties/CoreStrings.Designer.cs: Language not supported
roji
left a comment
There was a problem hiding this comment.
Hey, looks good - see code quailty comments below.
roji
left a comment
There was a problem hiding this comment.
See last minor suggestions, otherwise LGTM.
| /// Which parametrized collection translation mode should be used. | ||
| /// </summary> | ||
| public ParameterizedCollectionMode ParameterizedCollectionMode { get; init; } | ||
| public ParameterTranslationMode ParameterizedCollectionMode { get; init; } |
There was a problem hiding this comment.
Given the new naming, maybe call this CollectionParameterTranslationMode for consistency etc. (also elsewhere)
There was a problem hiding this comment.
UseParameterizedCollectionMode stays?
There was a problem hiding this comment.
I guess in the interest of avoiding another design discussion on the public API at this late hour, let's just keep things as they are - disregard my above comment...
Closes #36357.