Wcf Data Service: How to Handle Case-Insensitive Requests

I have a Wcf data service (it uses the OData protocol), and using this query, I want all countries whose stars have "Ca", and this works:

http: //localhost/TestService/Data.svc/Countries ? $ filter = startswith (Name, ' Ca ') eq true

But I can not get it to work with the following query:

http: //localhost/TestService/Data.svc/Countries ? $ filter = startswith (Name, ' ca ') eq true

This is an automatic service for countries, and I do not consider it case sensitive. Any ideas?

+6
source share
1 answer

You can use tolower (or toupper), for example: / Countries? $ = Filter StartsWith (ToLower (name), ToLower ('Ca'))

+14
source

Source: https://habr.com/ru/post/901119/


All Articles