Last post Dec 21, 2016 08:49 AM by Chris Zhao
Dec 20, 2016 04:37 PM|srscott|LINK
I'm hoping someone here can help settle a matter. I've been searching for a definitive answer for a while and have come up empty.
We're building an OData Web API and a question has come up around the metadata. We have a couple of cases where we use contained entities. That is, entity B is only accessible through entity A. So a request to get entity type B with the ID 2 might look like
this: http://www.myapi.com/v1.0/A(1)/B(2). It is not possible to request
Functionally this all works fine. We just had to specify the navigation targets during startup. The issue, if there is one, is in how the metadata for our endpoint is generated. Entity types A and B are both listed at the same level of the metadata. E.g.:
<PropertyRef Name="AId" />
<NavigationProperty Name="B" Type="Collection(Myapi.Graph.Models.B)" />
<PropertyRef Name="BId" />
There is a disagreement over whether or not this is syntactically correct. Some feel that because entity type B is not available at the top level of the API it should not be at the same level of the metadata as entity type A. Others feel that entity type
A correctly specifies a navigation property for entity type B, and because B is, in fact, an entity, that this is all as it should be.
I've been unable to find documentation of any other way for the metadata to be structured in this situation, which leads me to suspect that the above is correct and valid, but I'd like to find something definitive one way or the other. If anyone can point
me towards something like that I would be most grateful.
Dec 21, 2016 08:49 AM|Chris Zhao|LINK
About Metadata Document, you could refer these links.