Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use camelCase for OData WebAPI query string options?

I'd like to use camelCase in my OData query like this

/api/posts?$filter=someProperty eq 1

instead of PascalCase like so

/api/posts?$filter=SomeProperty eq 1

Is that possible? (Without changing the casing of my C# classes of course.)

like image 362
Jeremy Cook Avatar asked Dec 26 '22 22:12

Jeremy Cook


1 Answers

Finally this feature now is supported in Microsoft ASP.NET Web API 2.2 for OData v4.0 v5.4.0. You can install it via nuget Install-Package Microsoft.AspNet.OData -Pre and enable case insensitive:

config.EnableCaseInsensitive(true);

More info here.

like image 126
Iman Mahmoudinasab Avatar answered Dec 28 '22 12:12

Iman Mahmoudinasab