wcfasp.net-web-apiodata

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


Solution

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