Bud*_*hiP 6 .net odata asp.net-web-api asp.net-web-api-odata
我正在使用带有OData V4的WebAPI 2.2.
我可以使用$filter=RelatedObj/PropertyName eq 'Some Value'基于相关对象属性值来过滤实体列表.
但是,当我尝试使用相同的语法时$select:
$select=Id,Name,RelatedObj/PropertyName
Run Code Online (Sandbox Code Playgroud)
结果例外:
"message": "The query specified in the URI is not valid. Found a path with multiple navigation properties or a bad complex property path in a select clause. Please reword your query such that each level of select or expand only contains either TypeSegments or Properties.",
"innererror": {
"message": "Found a path with multiple navigation properties or a bad complex property path in a select clause. Please reword your query such that each level of select or expand only contains either TypeSegments or Properties.",
"type": "Microsoft.OData.Core.ODataException",
Run Code Online (Sandbox Code Playgroud)
这可以解决吗?
您可以使用$expand和嵌套$select查询选项来完成
$select=Id,Name&$expand=RelatedObj($select=PropertyName)
Run Code Online (Sandbox Code Playgroud)
请参阅ODATA文档
| 归档时间: |
|
| 查看次数: |
3289 次 |
| 最近记录: |