Begin() public method

public Begin ( ) : void
return void
Exemplo n.º 1
0
        internal override void DoStartTransaction()
        {
            if (!TransactionContext.InNetTransaction)
            {
                if (Transaction.Current != null)
                {
                    Tracer.Debug("NetTxSession detected Ambient Transaction, start new TX with broker");

                    // Start a new .NET style transaction, this could be distributed
                    // or it could just be a Local transaction that could become
                    // distributed later.
                    TransactionContext.Begin(Transaction.Current);
                }
            }
        }
Exemplo n.º 2
0
        private void EnrollInSpecifiedTransaction(Transaction tx)
        {
            if (TransactionContext.InNetTransaction)
            {
                Tracer.Warn("Enlist attempted while a Net TX was Active.");
                throw new InvalidOperationException("Session is Already enlisted in a Transaction");
            }

            if (Transaction.Current != null && !Transaction.Current.Equals(tx))
            {
                Tracer.Warn("Enlist attempted with a TX that doesn't match the Ambient TX.");
                throw new ArgumentException("Specified TX must match the ambient TX if set.");
            }

            // Start a new .NET style transaction, this could be distributed
            // or it could just be a Local transaction that could become
            // distributed later.
            TransactionContext.Begin(tx);
        }