如何根据OData中孩子的某些属性订购对象?

smo*_*hie 12 odata

我正在尝试使用此URL在OData中进行一些自定义排序

localhost:82/odata.svc/ComponentPresentations?$filter=TemplateId eq 2894 and publicationId eq 10&$expand=Component/Keywords?$orderby=Title desc
Run Code Online (Sandbox Code Playgroud)

哪里Component是的属性ComponentPresentationKeywords是的财产Component,我想根据关键字的ComponentPresentation排序Title属性.但是关键字和标题是组件演示的属性

有没有办法根据Keword标题的属性对结果进行排序?哪个是组件的子项,它是ComponentPresentation的子项?

Vla*_*adL 11

只想提一下,从OData V4开始就有可能.您可以根据需要嵌套任意数量的扩展/选择/顺序/过滤器.现在就这么简单

http://services.odata.org/V4/Northwind/Northwind.svc/Orders?$select=OrderID&$expand=Order_Details($select=UnitPrice;$orderby=Quantity)

  • @inane v1,v2和v3 - 不可能 (2认同)

Mar*_*SFT 9

因此能够通过一个嵌套单基数属性对结果进行排序,例如:http://services.odata.org/V3/Northwind/Northwind.svc/Orders?$top=50&$expand=Customer&$orderby=Customer /市

AFAIK,使用具有许多基数的导航属性不可能做到这一点(尽管在扩展方案中用于订购扩展Feed中返回的内容会很有用).