Hi guys,
I found out, that the QueryableExtension always generates a ToLower for strings filtered with the equals operator. The ToLower is applied by the FilterOperatorExtensions in this method:
private static Expression GenerateEqual(
Expression left,
Expression right,
bool liftMemberAccess)
{
if (left.Type == typeof (string))
{
left = FilterOperatorExtensions.GenerateToLowerCall(left, liftMemberAccess);
right = FilterOperatorExtensions.GenerateToLowerCall(right, liftMemberAccess);
}
return (Expression) Expression.Equal(left, right);
}It would be nice, if the to lower is controllable with a parameter. At the moment it generates a to lower in the sql query, which generates a lot of overhead in some situations with large tables.
At the moment I remove all "equal to" filter and apply it manually to the IQueryable object.
Best regards
Moritz
I see where you're coming from. And I guess, based on the COLLATION of the SQL database, it might not matter.
And this is not an argument against, just something of which to be aware:
In EF Core 3.x, string.Equals(x, y, StringComparison.OrdinalIgnoreCase) no longer works and requires us to use x.ToUpper() == y.ToUpper() (or whatever).
Hello,
Indeed this sounds like a reasonable requirement. I am converting the ticket to a feature request so others can vote for it.
Regards,
Angel Petrov
Progress Telerik