Question

Given a structure where two types are exposed in an OData system with a master/detail relationship:

Order
- OrderDetails

How would you filter a query of orders based upon the count of associated OrderDetails? In my head, it's something along the lines of

/Orders$filter=count(OrderDetails) eq 0

But, of course there's no count function. So, how would you produce a list of orders which had no OrderDetails?

Was it helpful?

Solution

Very similar question to this one: Collection Exists Criteria in WCF Data Services Currently the OData protocol doesn't support any operator/query to do that. The best solution is to expose a service operation which exposes this kind of operation from the server directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top