gpt4 book ai didi

dynamics-crm-2011 - Dynamics CRM 插件和 Web 服务中的事务

转载 作者:行者123 更新时间:2023-12-01 11:23:44 26 4
gpt4 key购买 nike

我想确认我对在 Dynamics CRM 中管理交易的理解,并检查我是否遗漏了什么。

1) CRM 插件中的交易:
在 Event Pipeline 的 Stage 20 和 40 中注册的插件在 DB 事务下运行。因此,如果我在任何消息的前/后操作上注册了三个插件,并且如果第三个插件抛出异常,则前两个插件所做的更改也将回滚。这种理解是否正确?

2) CRM Web 服务中的交易:
如果使用 CRM Web Services 编写代码,我可以使用 ExecuteTransactionRequest request 和所有与此消息一起提供的请求消息将在一个 CRM DB 事务下运行。此消息似乎是在 2016 年版本中引入的,那么在 2016 年之前处理此类情况的理想方法是什么?

最佳答案

1)假设所有插件都同步运行,那么是的,所有更改都应该回滚。

Inclusion in database transactions

Plug-ins may or may not execute within the database transaction of the Microsoft Dynamics CRM platform. Whether a plug-in is part of the transaction is dependent on how the message request is processed by the pipeline. You can check if the plug-in is executing in-transaction by reading the IsInTransaction property inherited by IPluginExecutionContext that is passed to the plug-in. If a plug-in is executing in the database transaction and allows an exception to be passed back to the platform, the entire transaction will be rolled back. Stages 20 and 40 are guaranteed to be part of the database transaction while stage 10 may be part of the transaction.

Any registered plug-in that executes during the database transaction and that passes an exception back to the platform cancels the core operation. This results in a rollback of the core operation. In addition, any pre-event or post event registered plug-ins that have not yet executed and any workflow that is triggered by the same event that the plug-in was registered for will not execute.



2)
  • 是 ExecuteTransactionRequest 是 CRM 2016 的一项新功能。
  • 如果您有 CRM 2013+,您可以将逻辑放在 Action 中支持自动回滚。然后用输入调用 Action 。
  • 对于 CRM 2011,将逻辑放在插件中。然后触发插件,例如通过在 CRM 中创建记录。您还可以在新记录上捕获输入。
  • 关于dynamics-crm-2011 - Dynamics CRM 插件和 Web 服务中的事务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39489394/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com