Conversation
QueryKit wrote each filter value into the SQL as a literal. Each new value made new SQL text, so EF Core compiled a new query and the database made a new plan. ParameterizeFilterValues is now true by default, so one filter shape uses one cached plan. Set it to false to get the v1.14.2 literals. BREAKING CHANGE: Filter values are now field reads that EF Core sends as SQL parameters. The expression text and the SQL text change, and two filters that differ only in values print the same expression text. In-lists become parameters, which use OPENJSON on SQL Server and need compatibility level 130 or more. Set ParameterizeFilterValues to false to keep the v1.14.2 behavior.
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.
For later consideration in a major version. Do not merge now. #122 made parameters opt-in to keep v1.x non-breaking. This PR makes them the default again.
The
ParameterizeFilterValuessetting stays. A consumer can set it tofalseto keep the v1.14.2 literals.Summary
Expression.Constant. EF Core writes it into the SQL as a literal.nullstays a constant, so the SQL keepsIS NULL.new QueryKitConfiguration(s => s.ParameterizeFilterValues = false)gives the v1.14.2 literals.IQueryKitConfiguration: gets parameters. These configurations cannot opt out, because the setting is only onQueryKitConfiguration.Evidence
Expression text for
Title == "a"andTitle == "b":Generated SQL:
Tests, changed from the restore tests:
dotnet teston this branch: all unit and integration tests pass, 0 failures (Npgsql through Testcontainers).Merge Danger
Door: two-way
A later release can change the default back. Consumers can opt out now with one setting.
Blast Radius: consumers
expression.ToString()as the key. Two different filters get the same key, so the app can return rows for the wrong filter. This fails silently.Januaryin place ofnew Nullable1(January)`.ExpressionVisitorcode that readsConstantExpressionvalues now gets aMemberExpressionon an internal type.Microsoft.Data.SqlClient.SqlException: Incorrect syntax near '$'.Workarounds:UseSqlServer(conn, o => o.UseCompatibilityLevel(120)), orParameterizeFilterValues = false.