开发者

odata multiple entities for a reference

I have Student entity with one-to-many relation to Courses entity. I am not sure of the payload format to be used for referencing links in a one-t开发者_Go百科o-many relation.

The following is the link tag I am using in a one-to-one relation. Not sure how the tag would look like in a one-to-many relation.

 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/parent"
           type="application/atom+xml;type=entry"
           href="http://localhost:10080/school/odata/Parent(1)"></link>

Any ideas on the format when multiple entities to be referenced?


The format (in ATOM that is) is very similar. You just need to change the type to application/atom+xml;type=feed (since the result will be a feed of potentially multiple entries) and the href needs to point to a URL which returns that feed. This is also described here: http://www.odata.org/developers/protocols/atom-format#DeferredContent Note that it's totally up to you how the href looks like, the convention is /Students(1)/Courses (since that's how a client query would ask for it as well).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜