Dynamics 2011 相交/交汇实体
我有 3 个实体。
PortalRole
、Person
和 PersonPortalRole
PersonPortalRole
是一个交集实体,用于处理我的 多对多关系。
我通过 HTML Web 资源使用 JavaScript 来允许创建和删除该实体。我可以相当轻松地使用 REST 服务创建新实体,但找不到使用 PersonId
和 PortalRoleId
删除相交记录(两个查找字段)的方法。
有没有人接触过使用查找中的两个外键值通过 REST 删除记录?我试图首先使用过滤器获取对象,但似乎无法使用查找主键进行过滤。
正在尝试类似下面的方法,它返回 15 个条目,然后过滤结果以获取主键,然后使用该键删除,但不确定如何执行此操作。
SERVER/INSTANCE/XRMServices/2011/OrganizationData.svc/personportalrolesSet?$expand=Person,PortalRole
I have 3 entities.
PortalRole
, Person
and PersonPortalRole
PersonPortalRole
is a intersection entity to deal with my Many-Many relationship.
I am using JavaScript through a HTML web resource to allow the creation and removal of this entity. I can create new entities by using the REST service fairly easily but I can't find a way of deleting a intersect record (two lookup fields) using the PersonId
and PortalRoleId
.
Has anyone had any exposure to either deleting a record through REST using the two foreign keys values from a lookup? I was trying to get the object first using a filter but can't seemt o filter using the lookup primary keys.
Was trying something like below which returns 15 entries to then filter the results to get the primary key, and then delete using that key but not sure on the way to do this.
SERVER/INSTANCE/XRMServices/2011/OrganizationData.svc/personportalrolesSet?$expand=Person,PortalRole
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将根据该 URI 与 OData 服务进行交互。 OData 使用 Atom 提要返回内容列表,因此您可能会在每个
元素中找到一个包含资源 URL 的
元素。如果您向该 URL 发出 HTTP DELETE,那么您的资源将被删除。请参阅此处的文档 http://www.odata.org/developers/protocols/operations#DeletingEntries< /a>
Based on that URI, you are interacting with an OData service. OData uses Atom feeds for returning lists of stuff so you will likely find within each
<entry>
element a<id>
element that contains the URL of the resource. If you issue a HTTP DELETE to that URL then your resource will be deleted.See docs here http://www.odata.org/developers/protocols/operations#DeletingEntries
我不使用 REST 端点,但据我所知,除了通过发送
Disassociate
请求(或者如果您有权访问 SQL 框,直接该表中的插入/删除)。 MS 有一些 可用的示例代码展示了如何使用 REST 端点执行此操作。I don't use the REST endpoint, but there's no way I know of to end a many-to-many relationship except through sending a
Disassociate
request (or if you have access to the SQL box, direct insertion/deletion in that table). MS has some sample code available that shows how to do this using the REST Endpoint.