Unplanned
Last Updated: 18 Mar 2020 17:40 by Kyle
Moritz
Created on: 17 Mar 2020 14:19
Category: Grid
Type: Feature Request
0
Kendo.Mvc.Extensions.QueryableExtensions always lowers string equals

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

2 comments
Kyle
Posted on: 18 Mar 2020 17:40

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).

ADMIN
Angel Petrov
Posted on: 18 Mar 2020 13:23

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

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.