Inclusion in Database Transactions

By design, custom plug-ins can only be registered in the non-transaction pre-event and post-event stages of the event execution pipeline. However, it is possible for a plug-in to execute within the Microsoft Dynamics CRM database transaction even though the plug-in was registered in a non-transaction pipeline stage.

If a plug-in is registered for execution in a child pipeline and that child pipeline is executed by a parent pipeline that has started a database transaction, any database modifications initiated by plug-in Web service method calls in the child pipeline are also included in the parent pipeline's database transaction. If the child pipeline plug-in throws an exception or does not catch a thrown exception, the entire transaction is rolled back and the parent pipeline core operation is canceled.

Note There is no property or class method provided in the Event Framework for a plug-in to determine at run time if it is executing in a database transaction.