OData V4 $expand 嵌套 $filter 和 $orderby -- 在 expand 内组合 $filter 和 $orderby

gor*_*oth 5 odata asp.net-web-api2 odata-v4

我目前有一个 OData V4 服务,它具有以下模型。
“类别”——“代码”
对于每个类别,可以有许多代码。

我需要 $expand the Codes, $filter where Active = true 然后 $orderby Codes.Description。

目前,以下无需订购即可正常工作。

odata/Categories?$expand=Codes($filter=Active eq true)

这不起作用。

odata/Categories?$expand=Codes($filter=Active eq true&$orderby=Description)

我收到“URI 中指定的查询无效。位置 12 处的语法错误。” &“'描述)'中位置 12 处的语法错误。”

基本上它将“描述”之后的最后一个“)”作为错误读取。

gor*_*oth 6

我在 OData V4 文档中找不到这个,但我在这里找到了一个类似的例子“如何根据 OData 中子项的某些属性对对象进行排序?

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

我缺少的关键是

;

这在过滤器和 orderby 之间进行。
这是工作网址

odata/Categories?$expand=Codes($filter=Active eq true;$orderby=Description)