I read everywhere that in OData v3 you should use substringof()
and in v4 you should use contains()
. I installed Microsoft.AspNet.WebApi.OData from NuGet that says version 5.5.1.
Strangely, contains() doesn't work. I am getting the following error:
{"message":"The query specified in the URI is not valid. An unknown function with name 'contains' was found. This may also be a key lookup on a navigation property, which is not allowed." ... }
Conversely, substringof()
works fine. Is it supposed to be that way?
The NuGet package version is 5.5.1, but that does not refer to the supported OData version. As OData v1-3 and OData v4 have some non-compatible changes, there are two versions of the WebAPI OData package:
ASP.NET Web API 2.2 for OData v1-3
Package Id: Microsoft.AspNet.WebApi.OData, Version: 5.5.1
ASP.NET Web API 2.2 for OData v4
Package Id: Microsoft.AspNet.OData, Version: 5.6.0
So you are using OData v3 at the moment and the error message is correct, contains() is not defined in OData v3