Reputation: 4024
Is there a setting/configuration in .Net Core 2.2 where we can make oData queries to the backend like this and it would ignore the case? In the example below I would like all Cars with Brand FORD and Ford to appear in the search results
https://localhost/api/cars?$filter=contains(Brand,'FoRd')
I'm aware you can use toLower in the URL but I'm looking at a setting in the backend
Upvotes: 5
Views: 8045
Reputation: 2996
Thanks to Nan Yu's comment, I figured the reason for that example to work as case-insensitive is that instead of using an expression like:
contains(Name,'Dom')
they use:
contains(tolower(Name),'dom')
Do note that the field name (in this case Name
) is prefixed with an OData's function call toLower()
and the string 'Dom'
has been manually lowered to 'dom'
.
Upvotes: 6