ODataQuery.navigateTo() method to fetch related entities/collections
Closed this issue · 0 comments
buchatsky commented
jinqu-odata version
1.1.3
Current behavior
Only expansion is available
Proposed behavior
navigateTo() method (which is usually preseeded by byKey() method) should append a navigation entity/collection name to the request uri and return a query typed to the navigated entity type.
Expected code:
const query: IODataQuery<Address> = service.companies()
.byKey(5)
.navigateTo(c => c.address)
.select("id", "text");
const query2: IODataQuery<Address> = service.companies()
.byKey(5)
.navigateTo(c => c.addresses)
.where(a => a.text == 'nice')
Getting related entities on the server side using EF: here
PS. Already implemented in my repository.
PPS. Simple OData Client also supports chaining of calls like ByKey()-NavigateTo()-ByKey()-NavigateTo()-..., but it would require procecing QueryParts just in the loop, and if Ids are globally unique, we can always access related entities by key from the main EntitySet, so I didn't implement that.