System.Transactions.CommittableTransaction.BeginCommit C# (CSharp) Method

BeginCommit() public method

public BeginCommit ( AsyncCallback asyncCallback, object asyncState ) : IAsyncResult
asyncCallback AsyncCallback
asyncState object
return IAsyncResult
        public IAsyncResult BeginCommit(AsyncCallback asyncCallback, object asyncState)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
                etwLog.TransactionCommit(this, "CommittableTransaction");
            }

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

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

                // this.complete will get set to true when the transaction enters a state that is
                // beyond Phase0.
                _internalTransaction.State.BeginCommit(_internalTransaction, true, asyncCallback, asyncState);
            }

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

            return this;
        }

Same methods

CommittableTransaction::BeginCommit ( System asyncCallback, object asyncState ) : System.IAsyncResult

Usage Example

Example #1
0
		public void AsyncFail1 ()
		{
			IntResourceManager irm = new IntResourceManager ( 1 );

			CommittableTransaction ct = new CommittableTransaction ();
			/* Set ambient Tx */
			Transaction.Current = ct;

			/* Enlist */
			irm.Value = 2;

			IAsyncResult ar = ct.BeginCommit ( null, null );
			IAsyncResult ar2 = ct.BeginCommit ( null, null );
		}
All Usage Examples Of System.Transactions.CommittableTransaction::BeginCommit