-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
When nesting multiple expands inside another expand, the resulting odata query string contains multiple $expand tags in that nest, whilst they should be grouped into one $expand with comma seperated entity references.
Here is an invented code sample:
string oDataQuery = new ODataQueryBuilder()
.For<RootEntity>("root_entity")
.ByList()
.Expand(er => er
.For<MainRelatedEntity>(root => root.SomeListProperty)
.Expand(em => em
.For<SubRelatedEntity1>(main => main.SubProperty1)
.Select(sub1 => sub1.some_property)
)
.Expand(em => em
.For<SubRelatedEntity2>(main => main.SubProperty2)
.Select(sub2 => sub2.some_property)
)
)
.ToUri()
.ToString();
The result of this looks like:
root_entity?$expand=SomeListProperty($expand=SubRelatedEntity1($select=some_property);$expand=SubRelatedEntity2($select=some_property))
while it should be this:
root_entity?$expand=SomeListProperty($expand=SubRelatedEntity1($select=some_property),SubRelatedEntity2($select=some_property))
When sending the first request to my oData endpoint, it obviously ignores the first sub expand, and only takes into account the last one.
When expanding multiple relations on the root level, so without the nesting inside the MainRelatedEntity, then it works as expected. The key here is that they are nested.
Metadata
Metadata
Assignees
Labels
No labels