oData $expand on Derived Types

后端 未结 2 1957
囚心锁ツ
囚心锁ツ 2021-01-07 07:00

I am having challenges with odata query to get derived type:

{{Url}}/odata/resource?$expand=derivedType

See this link which gives options like ~/People/OfTy

2条回答
  •  借酒劲吻你
    2021-01-07 07:08

    The information in that blog post is out of date. The official OData specifications are available at http://www.odata.org/documentation/.

    In OData v4, you can filter by derived type by appending the fully-qualified name of the derived type to the resource URI path. For example, GET http://host/Employees/MyService.Manager would retrieve the subset of Employees who are also Managers (assuming Manager is derived from Employee type). The prefix MyService in the last path segment is the OData namespace in which the Manager type is defined.

    You can also filter by derived type when expanding a navigation property by appending the fully-qualified name of the derived type to the name of the property in an $expand clause. For example, GET http://host/Companies('Acme')?$expand=Employees/MyService.Manager would retrieve the Company named Acme with all Managers expanded inline.

提交回复
热议问题