2015-06-16 67 views
4

我使用WebAPI 2.2與OData V4。

我可以使用$filter=RelatedObj/PropertyName eq 'Some Value'根據相關的對象屬性值來過濾實體列表。

然而,當我嘗試使用與$select相同的語法:

$select=Id,Name,RelatedObj/PropertyName 

結果異常:

"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", 

這個問題能解決?

回答

-1

如果要對導航屬性下的項目執行$select,則需要先導航屬性$expand

EntitySet?$select=Id,Name,RelatedObj/PropertyName&$expand=RelatedObj 
+0

做我試了一下力工作 –