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

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose()
        {
            InternalDispose();
        }

Usage Example

        public async Task DistributedTransactionFromCompletionEventShouldBeTheOneToWhichTheEventIsAttachedAsync()
        {
            SysTran clone            = null;
            SysTran eventTransaction = null;

            try
            {
                using (CreateDistributedTransactionScope())
                {
                    _log.InfoFormat(
                        "Scope opened, id {0}, distributed id {1}",
                        SysTran.Current.TransactionInformation.LocalIdentifier,
                        SysTran.Current.TransactionInformation.DistributedIdentifier);
                    clone = SysTran.Current.Clone();
                    clone.TransactionCompleted += Clone_TransactionCompleted;
                    _log.Info("Scope not completed");
                }
                _log.Info("Scope disposed");
                while (eventTransaction == null)
                {
                    await(Task.Delay(10));
                }
                _log.Info("Event transaction received");
                Assert.That(eventTransaction, Is.SameAs(clone));
            }
            finally
            {
                clone?.Dispose();
            }

            void Clone_TransactionCompleted(object sender, TransactionEventArgs e)
            {
                eventTransaction = e.Transaction;
            }
        }
All Usage Examples Of System.Transactions.Transaction::Dispose