我需要将我的 OData 服务更新到第三个版本。现在,我只用 NuGet 存储库中的新库和 DataServiceConfiguration 将属性 MaxProtocolVersion 设置为 V3 更改了旧库。
可能这还不够吗?有人知道,我必须做什么才能支持我的应用程序中的任何/所有过滤器?
当我尝试发送这样的请求时: http:
//expamle.com/OData.svc/Contacts ?$filter=Phones/any(p: p/Number eq '111-222-333-11')
我的应用程序抛出此异常:
<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>