0

我正在尝试将原子格式的链接条目发布到 Odata 服务。我的有效负载中唯一缺少的是 rel-attribute 应该是:“ http://schemas.microsoft.com/ado/2007/08/dataservices/related/SOItems ”。目前它自动生成到“ http://schemas.microsoft.com/ado/2007/08/dataservices/related/links

这是我当前的链接条目:

<a:link href="SOItems" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/links" type="application/atom+xml;type=entry"><m:inline><a:feed><a:entry><a:author><a:name></a:name></a:author><a:content type="application/xml"><m:properties><d:OrderId>0</d:OrderId><d:Item>000020</d:Item><d:Material>M-06</d:Material><d:Plant>1200</d:Plant><d:Quantity>200.000</d:Quantity><d:Description m:null="true"></d:Description><d:UoM m:null="true"></d:UoM><d:Value m:null="true"></d:Value></m:properties></a:content></a:entry><a:entry><a:author><a:name></a:name></a:author><a:content type="application/xml"><m:properties><d:OrderId>0</d:OrderId><d:Item>000020</d:Item><d:Material>M-06</d:Material><d:Plant>1200</d:Plant><d:Quantity>200.000</d:Quantity><d:Description m:null="true"></d:Description><d:UoM m:null="true"></d:UoM><d:Value m:null="true"></d:Value></m:properties></a:content></a:entry></a:feed></m:inline></a:link>

如何使用 datajs 为链接条目设置 rel 属性。

谢谢,

溴,反相

4

1 回答 1

0

链接的命名空间“ http://schemas.microsoft.com/ado/2007/08/dataservices/related/links ”是datajs代码的硬代码。目前没有应用程序可以用来更改它的公共 API。但是,由于datajs是开源的,所以还是有一些方法可以通过修改datajs代码来解决这个问题:

a) 更改 data.js 中本地属性“odataRelatedLinksPrefix”的值

b) 通过在 data.js 代码中添加 odata.odataRelatedLinksPrefix = odataRelatedLinksPrefix 将局部变量“odataRelatedLinksPrefix”公开。完成此操作后,应用程序可以随时随地通过调用 OData.odataRelatedLinksPrefix 来更改命名空间值。

于 2014-01-13T01:34:46.000 回答