如何扩展(odata-webapi)所有属性而不在 vb.net 中传递查询字符串中的$expand



我正在使用 odata v5.7.0 for webapi(vb.net(。我需要扩展对象的所有属性,而无需对查询字符串使用$expand属性。

例如:http://localhost:26209/ProductList?$expand=customers/products

http://localhost:26209/ProductList

不知道你为什么要这样做,可能没有一个明确的方法来实现它。不过,如果您想为客户获得所有产品,则必须使用这样的东西一次一个。

http://localhost:26209/ProductList/customers('customer_id')/products

否则,如果您使用的是 OData 2,则每个关联都有一个实体集,因此您可以直接查询products实体集并改用$filter。该网址将类似于

http://localhost:26209/Products?$filter=CustomerId eq *

您可以在此处查看$filter约定

最新更新