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
The following statement should return what you are looking for:
var query = from c in Service.Brands.Expand("Families/Models")
This will run the following odata query:
.../OData.svc/Brands?$expand=Families/Models
Here is a link to some further odata documentation:
The syntax of a $expand query option is a comma-separated list of Navigation Properties. Additionally each Navigation Property can be followed by a forward slash and another Navigation Property to enable identifying a multi-level relationship.
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 !