根据链接计数过滤 OData 查询?
给定一个结构,其中在 OData 系统中公开两种类型并具有主/详细关系:
订单
- OrderDetails
您将如何根据关联的 OrderDetails 计数过滤订单查询?在我看来,它类似于
/Orders$filter=count(OrderDetails) eq 0
但是,当然没有计数函数。那么,如何生成没有 OrderDetails 的订单列表呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与此问题非常相似:WCF 数据服务中的集合存在条件
目前,OData 协议不支持任何运算符/查询来执行此操作。最好的解决方案是公开一个服务操作,直接从服务器公开此类操作。
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.