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

EndCommit() public method

public EndCommit ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult
return void
        public void EndCommit(IAsyncResult asyncResult)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
            }

            if (asyncResult != ((object)this))
            {
                throw new ArgumentException(SR.BadAsyncResult, nameof(asyncResult));
            }

            lock (_internalTransaction)
            {
                do
                {
                    if (_internalTransaction.State.IsCompleted(_internalTransaction))
                    {
                        break;
                    }
                } while (Monitor.Wait(_internalTransaction));

                _internalTransaction.State.EndCommit(_internalTransaction);
            }

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

Same methods

CommittableTransaction::EndCommit ( System ar ) : void

Usage Example

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

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

			/* Enlist */
			irm.Value = 2;
			irm.FailPrepare = true;

			IAsyncResult ar = ct.BeginCommit ( null, null );

			ct.EndCommit ( ar );
		}
All Usage Examples Of System.Transactions.CommittableTransaction::EndCommit