is it possible to Query an Odata service and expand Child of Child entities?

后端 未结 2 1230
借酒劲吻你
借酒劲吻你 2020-12-08 07:49

This sounds rather simple (and maybe I\'m missing the obvious here) but I can\'t find a solution. I know I can query an entity and return one, or many direct child entities

2条回答
  •  心在旅途
    2020-12-08 08:28

    In ASP.NET OData v4, the URL convention seems to have changed. It is now:

    ~/Brands?$expand=Families($expand=Models)
    

    You can also select the stuff you want in sub-entities.
    For example if you want just the brand family identifiers:

    ~/Brands?$expand=Families($select=Id)
    

    Furthermore, if you want only the identifiers of the brand family models, you would do that:

    ~/Brands?$expand=Families($expand=Models($select=Id))
    

    ...and so on. Hope this helps !

提交回复
热议问题