如何根据OData中子级的某些属性对对象进行排序? [英] How can I order objects according to some attribute of the child in OData?
问题描述
我正在尝试使用此URL在OData中进行一些自定义排序
I'm trying to do some custom sorting in OData using this URL
localhost:82/odata.svc/ComponentPresentations?$filter=TemplateId eq 2894 and publicationId eq 10&$expand=Component/Keywords?$orderby=Title desc
其中Component
是ComponentPresentation
的属性,而Keywords
是Component
的属性,我想根据关键字的Title
属性对ComponentPresentation进行排序.但是关键字或标题都是Component Presentation的属性
Where Component
is a property of ComponentPresentation
and Keywords
is property of Component
, and I want to sort the ComponentPresentation according to the keyword's Title
attribute. But keywords nor title is a property of Component Presentation
有没有一种方法可以根据Keword标题的属性对结果进行排序?哪个是Component的子代,哪个是ComponentPresentation的子代?
Is there a way to sort the results according to the attribute of Keword's title? Which is a Child of Component, which is a child of ComponentPresentation?
推荐答案
只想提一下自OData V4起就有可能.您可以根据需要嵌套任意数量的扩展/选择/排序/过滤器.现在就这么简单
Just want to mention that it is possible since OData V4. You can nest as many expands/selects/orderby/filters as you wish. Now it is as simple as
这篇关于如何根据OData中子级的某些属性对对象进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!