System.Transactions.Transaction.EnlistDurable C# (CSharp) Method

EnlistDurable() public method

public EnlistDurable ( Guid resourceManagerIdentifier, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions ) : Enlistment
resourceManagerIdentifier Guid
enlistmentNotification IEnlistmentNotification
enlistmentOptions EnlistmentOptions
return Enlistment
        public Enlistment EnlistDurable(
            Guid resourceManagerIdentifier,
            IEnlistmentNotification enlistmentNotification,
            EnlistmentOptions enlistmentOptions)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (resourceManagerIdentifier == Guid.Empty)
            {
                throw new ArgumentException(SR.BadResourceManagerId, nameof(resourceManagerIdentifier));
            }

            if (enlistmentNotification == null)
            {
                throw new ArgumentNullException(nameof(enlistmentNotification));
            }

            if (enlistmentOptions != EnlistmentOptions.None && enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired)
            {
                throw new ArgumentOutOfRangeException(nameof(enlistmentOptions));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(DistributedTxId);
            }

            lock (_internalTransaction)
            {
                Enlistment enlistment = _internalTransaction.State.EnlistDurable(_internalTransaction,
                    resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, this);

                if (etwLog.IsEnabled())
                {
                    etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
                }

                return enlistment;
            }
        }

Same methods

Transaction::EnlistDurable ( Guid resourceManagerIdentifier, ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions ) : Enlistment
Transaction::EnlistDurable ( System resourceManagerIdentifier, System enlistmentNotification, System enlistmentOptions ) : System.Transactions.Enlistment

Usage Example

 public void Enlist(Transaction tx)
 {
     tx.EnlistDurable(_transactionExecutionEnvironment.ResourceManagerId, this, EnlistmentOptions.None);
 }
All Usage Examples Of System.Transactions.Transaction::EnlistDurable