Query: Translate String.CompareTo() #7095
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-enhancement
Milestone
To reproduce
@rowanmiller
See this attached example to reproduce:
efcore_example.zip
Small Console-app example that shows SQL-server filtering.
It works / generates SQL when filtering on >= and <= for int-values:
SELECT [p].[Id], [p].[Age], [p].[Name]
FROM [Persons] AS [p]
WHERE ([p].[Age] >= @__range_Start_0) AND ([p].[Age] <= @__range_End_1)
It doesn't work / doesn't generate SQL when filtering using Compare/CompareTo for string-values:
The LINQ expression '(False OrElse (([_1].Name.CompareTo(__range_Start_0) >= 0) AndAlso ([_1].Name.CompareTo(__range_End_1) <= 0)))' could not be translated and will be evaluated locally. To configure this warning use the DbContextOptionsBuilder.ConfigureWarnings API (event id 'RelationalEventId.QueryClientEvaluationWarning'). ConfigureWarnings can be used when overriding the DbContext.OnConfiguring method or using AddDbContext on the application service provider.
To reproduce:
dotnet restore
dotnet run
Further technical details
EF Core version: 1.1.0
$ dotnet --version
1.0.0-preview2-1-003177
Relates to these other issues #1767, #3464, #5369
The text was updated successfully, but these errors were encountered: