OData - 按嵌套属性过滤

Ari*_*iel 13 odata

有没有人知道如何表达对嵌套属性的OData $过滤器?

对于前 我有以下Atom条目,

<entry>
...
 <m:properties>
...
  <d:RegardingObjectId m:type="Microsoft.Crm.Sdk.Data.Services.EntityReference">
  <d:Id m:type="Edm.Guid">3f3712fd-fc49-e211-8eb8-000c296272c8</d:Id> 
  <d:LogicalName>new_sportsleague</d:LogicalName> 
  <d:Name>Boca</d:Name> 
  </d:RegardingObjectId>
Run Code Online (Sandbox Code Playgroud)

我想过滤那些具有AboutObjectId/LogicalName eq'new_sportsleague'的条目.

尝试使用'ConcerObjectId/LogicalName'和'ConcerObjectId.LogicalName'没有运气.

Jen*_*n S 19

'RegardingObjectId/LogicalName' 将是正确的语法.

例如:

http://services.odata.org/v3/OData/OData.svc/Suppliers

返回两个结果,而

http://services.odata.org/v3/OData/OData.svc/Suppliers?$ filter = Address/Street eq'NE 228th'

只返回一个.

我没有看到OData规范中明确说明使用复杂值的属性进行过滤是否合法的地方,但WCF数据服务似乎支持它.可能是其他OData实现没有.


小智 6

使用以下 odata API 示例通过过滤器数据访问嵌套属性

http://192.168.50.152:50086/odata/StationOperationLogs/?$expand=ProductionStation,ProductionStation/ProductionUnit&$filter=ProductionStation/ProductionUnit/Id eq 2
Run Code Online (Sandbox Code Playgroud)