Reputation: 15
I need update my OData service to third version. Now, I'm only changed old libraries with new from NuGet repository and in DataServiceConfiguration set property MaxProtocolVersion to V3.
May be this is not enough? Somebody know, What exactly I must do for support any/all filters in my application?
When I try send request like this:
http://expamle.com/OData.svc/Contacts?$filter=Phones/any(p: p/Number eq '111-222-333-11')
My application throwing this exception:
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code>4</code>
<message xml:lang="" />
<innererror>
<message>No property 'any' exists in type 'City' at position 5.</message>
<type>System.Data.Services.DataServiceException</type>
<stacktrace>
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseMemberAccess(Expression instance)
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParsePrimary()
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseUnary()
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseMultiplicative()
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseAdditive()
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseComparison()
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseLogicalAnd()
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseLogicalOr()
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseExpression()
at System.Data.Services.Parsing.RequestQueryParser.ExpressionParser.ParseWhere()
at System.Data.Services.Parsing.RequestQueryParser.ParseLambdaForWhere(IDataService service, RequestDescription requestDescription, Type queryElementType, String expression)
at System.Data.Services.Parsing.RequestQueryParser.Where(IDataService service, RequestDescription requestDescription, Expression source, String predicate)
at System.Data.Services.RequestQueryProcessor.ProcessFilter() at System.Data.Services.RequestQueryProcessor.ProcessQuery()
at System.Data.Services.RequestQueryProcessor.ProcessQuery(IDataService service, RequestDescription description)
at System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service, Boolean internalQuery)
at System.Data.Services.DataService`1.ProcessIncomingRequestUri()
at System.Data.Services.DataService`1.HandleRequest()
</stacktrace>
</innererror>
</error>
Upvotes: 1
Views: 1052
Reputation: 13320
Did you make sure that you enabled any/all support in the DataServiceBehavior? http://msdn.microsoft.com/en-us/library/system.data.services.dataservicebehavior.acceptanyallrequests(v=vs.103).aspx
Upvotes: 1
Reputation: 20924
It sounds like City is a singleton (not a collection) in which case you don't need any, something like this would work just fine:
i.e. http://example.com/OData.svc/Contacts?$filter=City/Name eq 'New York'
Any/All only apply to collections referenced in the $filter.
Upvotes: 0
Reputation: 67928
It is likely you need to update your WCF Data Services to 5.0 to support v3 - you can download it here.
Upvotes: 0