如何在OData上扩展多个属性 [英] How to expand multiple properties on OData
本文介绍了如何在OData上扩展多个属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑一下我有这个OData表达式:
Consider I have this OData expression:
http://services.odata.org/northwind/northwind.svc/Categories?
$expand=Products/Category
它将正确展开Products.Category
.
现在我也想扩展另一个属性.例如'Products.Supplier`.
Now I want to expand another property too. For example 'Products.Supplier`.
我尝试复制$expand
用法:
http://services.odata.org/northwind/northwind.svc/Categories?
$expand=Products/Category
&$expand=Products/Supplier
但返回此错误失败:
Query parameter '$expand' is specified, but it should be specified exactly once.
推荐答案
根据OData ABNF,展开语法应为:
According to OData ABNF, expand syntax should be:
expand ='$ expand'EQ expandItem *(COMMA expandItem)
expand = '$expand' EQ expandItem *( COMMA expandItem )
等于:
$expand=expandItem1,expandItem2,expandItem3,...
所以请尝试:
http://services.odata .org/northwind/northwind.svc/Categories?$ expand =产品/类别,产品/供应商
有关更多信息,请参见:
For more information, see:
http://www.odata.org /documentation/odata-version-2-0/uri-conventions/#ExpandSystemQueryOption
这篇关于如何在OData上扩展多个属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文