通过导航属性更新资源可能吗? [英] Update resources through navigation properties possible?

查看:81
本文介绍了通过导航属性更新资源可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个资源A,它的导航属性指向资源B.该方案如下所示:

I have a resource A that has a navigation property that points to resource B. The schema looks like this:

资源A:

  • ID
  • B(这是一对多导航属性)

资源B:

  • ID
  • 属性1
  • 属性2

我可以通过A的导航链接更新资源B的值(即更新B的属性1和属性2)吗?换句话说,我可以说A.B [5] .Property1 = x吗?

Can I update values of resource B (i.e. update property1 and property2 of B) through the navigation link of A? In other words, can I say A.B[5].Property1 = x?

在OData规范和示例中,我仅看到有关修改B的哪个实例与A关联的说明(即,修改/A(0)/$ links/B),但没有说明我是否可以执行PUT/合并到/A(0)/B(2)并修改B本身.

In the OData spec and examples, I only see descriptions of modifying which instance of B is associated with A (i.e. modifying /A(0)/$links/B), but not whether or not I can do a PUT/MERGE to /A(0)/B(2) and modify B itself.

推荐答案

您应该能够将PUT请求发送到/A(0)/B(2)并修改B的属性.

You should be able to send a PUT request to /A(0)/B(2) and modify properties of B.

这篇关于通过导航属性更新资源可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆