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

EnlistVolatile() public method

public EnlistVolatile ( IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions ) : Enlistment
enlistmentNotification IEnlistmentNotification
enlistmentOptions EnlistmentOptions
return Enlistment
        public Enlistment EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
            }
 
            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            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.EnlistVolatile(_internalTransaction,
                    enlistmentNotification, enlistmentOptions, this);

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

Same methods

Transaction::EnlistVolatile ( ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions ) : Enlistment
Transaction::EnlistVolatile ( System enlistmentNotification, System enlistmentOptions ) : System.Transactions.Enlistment

Usage Example

    internal SQLiteEnlistment(SQLiteConnection cnn, Transaction scope)
    {
      _transaction = cnn.BeginTransaction();
      _scope = scope;

      _scope.EnlistVolatile(this, System.Transactions.EnlistmentOptions.None);
    }
All Usage Examples Of System.Transactions.Transaction::EnlistVolatile