System.Transactions.DurableEnlistmentAborting.EnterState C# (CSharp) Method

EnterState() private method

private EnterState ( InternalEnlistment enlistment ) : void
enlistment InternalEnlistment
return void
        internal override void EnterState(InternalEnlistment enlistment)
        {
            // Set the enlistment state
            enlistment.State = this;

            Monitor.Exit(enlistment.Transaction);
            try
            {
                TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
                if (etwLog.IsEnabled())
                {
                    etwLog.EnlistmentStatus(enlistment, NotificationCall.Rollback);
                }

                // Send the Rollback notification to the enlistment
                if (enlistment.SinglePhaseNotification != null)
                {
                    enlistment.SinglePhaseNotification.Rollback(enlistment.SinglePhaseEnlistment);
                }
                else
                {
                    enlistment.PromotableSinglePhaseNotification.Rollback(enlistment.SinglePhaseEnlistment);
                }
            }
            finally
            {
                Monitor.Enter(enlistment.Transaction);
            }
        }

Usage Example

 internal override void InternalAborted(InternalEnlistment enlistment)
 {
     // Transition to the aborting state
     DurableEnlistmentAborting.EnterState(enlistment);
 }