Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: Error trying to query on Count property of a navigation property returning collection. [680]

$
0
0
I was using the ODataServiceSample for this scenario. I am trying to do the following:<br /><br />Get product families which have more than 20 products.<br /><br />Code:<br /> foreach (var family in ctx.ProductFamilies.Where(pf => pf.Products.Count > 20))<br /> {<br /> Console.WriteLine("\t{0}-{1}", family.ID, family.Name);<br /> }<br /><br />The url which gets generated is:<br />http://kirandesktop:50231/ProductFamilies()?$filter=Products/Count gt 20<br /><br />I am receiving the following error when doing so:<br />----------------------------------<br />HTTP/1.1 400 Bad Request<br />Content-Length: 2725<br />Content-Type: application/xml; charset=utf-8<br />Server: Microsoft-HTTPAPI/2.0<br />DataServiceVersion: 3.0;<br />Date: Wed, 05 Dec 2012 19:19:10 GMT<br /><br /><?xml version="1.0" encoding="utf-8"?><br /><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><br /> <m:code /><br /> <m:message xml:lang="en-US">The query specified in the URI is not valid.</m:message><br /> <m:innererror><br /> <m:message>The parent value for a property access of a property 'Products' is not a single value. Property access can only be applied to a single value.</m:message><br /> <m:type>Microsoft.Data.OData.ODataException</m:type><br /> <m:stacktrace> at Microsoft.Data.OData.Query.NonRootSegmentBinder.ValidateMultiplicityMatches(NonRootSegmentToken segmentToken, EdmMultiplicity targetMultiplicity)<br /><br /> at Microsoft.Data.OData.Query.NonRootSegmentBinder.BindNonRootSegment(NonRootSegmentToken segmentToken, BindingState state)<br /><br /> at Microsoft.Data.OData.Query.MetadataBinder.Bind(QueryToken token)<br /><br /> at Microsoft.Data.OData.Query.PropertyAccessBinder.GetParentFromToken(PropertyAccessQueryToken propertyAccessToken)<br /><br /> at Microsoft.Data.OData.Query.PropertyAccessBinder.BindPropertyAccess(PropertyAccessQueryToken propertyAccessToken, BindingState state)<br /><br /> at Microsoft.Data.OData.Query.MetadataBinder.BindPropertyAccess(PropertyAccessQueryToken propertyAccessToken)<br /><br /> at Microsoft.Data.OData.Query.MetadataBinder.Bind(QueryToken token)<br /><br /> at Microsoft.Data.OData.Query.BinaryOperatorBinder.GetOperandFromToken(BinaryOperatorKind operatorKind, QueryToken queryToken)<br /><br /> at Microsoft.Data.OData.Query.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorQueryToken binaryOperatorToken)<br /><br /> at Microsoft.Data.OData.Query.MetadataBinder.Bind(QueryToken token)<br /><br /> at Microsoft.Data.OData.Query.FilterBinder.BindFilter(CollectionNode path, QueryToken filter)<br /><br /> at Microsoft.Data.OData.Query.ODataUriParser.ParseFilter(String filter, IEdmModel model, IEdmType elementType, IEdmEntitySet entitySet)<br /><br /> at System.Web.Http.OData.Query.FilterQueryOption.get_FilterClause()<br /><br /> at System.Web.Http.OData.Query.Validators.FilterQueryValidator.Validate(FilterQueryOption filterQueryOption, ODataValidationSettings settings)<br /><br /> at System.Web.Http.OData.Query.Validators.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)<br /><br /> at System.Web.Http.QueryableAttribute.ValidateQuery(HttpRequestMessage request, ODataQueryOptions queryOptions)<br /><br /> at System.Web.Http.QueryableAttribute.ExecuteQuery(IEnumerable query, HttpRequestMessage request, HttpConfiguration configuration, HttpActionDescriptor actionDescriptor)<br /><br /> at System.Web.Http.QueryableAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)</m:stacktrace><br /> </m:innererror><br /></m:error>

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>