Fix regression to allow LIKE translation for string comparison queries with non-constant args#387
Open
po-gl wants to merge 1 commit into
Open
Conversation
- affects translations for StartsWith, EndsWith, and Contains methods - regression introduced in 4ac27f6 - adds tests
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.
Closes #386
Resolves regression introduced during the upgrade to .NET 10 (4ac27f6)
In EF Core 9, the
.Nameproperty onSqlParameterExpressionwas prefixed with "__", i.e.QueryCompilationContext.QueryParameterPrefix. In EF Core 10, the prefix was removed as they were no longer needed to distinguish between parameter types (dedicated types were introduced). The prefix was not replaced with "@" or any other symbol, thus the existing guard inGetLikeExpressionUsingParameterwill always fail. Similar guard statements were removed in EF Core 10 for the first party Sql server and Sqlite EFCore implementations.Removing the guard allows the translator to use LIKE expressions for StartsWith, EndsWith, and Contains methods with non-constant arguments. For example, the following query (excerpt from repro code in issue):
will translate to the following SQL with the changes from this PR: