protected override bool IsExistingTransaction(object transaction)
        {
            PromotableTxScopeTransactionObject txObject =
                (PromotableTxScopeTransactionObject)transaction;

            return(txObject.TxScopeAdapter.IsExistingTransaction);
        }
        private void DoTxScopeBegin(PromotableTxScopeTransactionObject txObject,
                                    Spring.Transaction.ITransactionDefinition definition)
        {
            TransactionScopeOption txScopeOption = CreateTransactionScopeOptions(definition);
            TransactionOptions     txOptions     = CreateTransactionOptions(definition);

            txObject.TxScopeAdapter.CreateTransactionScope(txScopeOption, txOptions, definition.EnterpriseServicesInteropOption);
        }
        protected override object DoSuspend(object transaction)
        {
            // Passing the current TxScopeAdapter as the 'suspended resource', even though it is not used just to avoid passing null
            // TxScopeTransactionManager is not binding any resources to the local thread, instead delegating to
            // System.Transactions to handle thread local resources.
            PromotableTxScopeTransactionObject txMgrStateObject = (PromotableTxScopeTransactionObject)transaction;

            return(txMgrStateObject.TxScopeAdapter);
        }
        protected override object DoGetTransaction()
        {
            PromotableTxScopeTransactionObject txObject = new PromotableTxScopeTransactionObject();

            if (txAdapter != null)
            {
                txObject.TxScopeAdapter = txAdapter;
            }
            return txObject;
        }
        protected override object DoGetTransaction()
        {
            PromotableTxScopeTransactionObject txObject = new PromotableTxScopeTransactionObject();

            if (txAdapter != null)
            {
                txObject.TxScopeAdapter = txAdapter;
            }
            return(txObject);
        }
Example #6
0
        private void DoTxScopeBegin(
            PromotableTxScopeTransactionObject txObject,
            ITransactionDefinition definition)
        {
            TransactionScopeOption txScopeOption = CreateTransactionScopeOptions(definition);
            TransactionOptions     txOptions     = CreateTransactionOptions(definition);

            txObject.TxScopeAdapter.CreateTransactionScope(
                txScopeOption,
                txOptions,
                definition.AsyncFlowOption);
        }
        protected override void DoBegin(object transaction, Spring.Transaction.ITransactionDefinition definition)
        {
            PromotableTxScopeTransactionObject txObject =
                (PromotableTxScopeTransactionObject)transaction;

            try
            {
                DoTxScopeBegin(txObject, definition);
            }
            catch (Exception e)
            {
                throw new CannotCreateTransactionException("Transaction Scope failure on begin", e);
            }
        }
        protected override void DoRollback(DefaultTransactionStatus status)
        {
            PromotableTxScopeTransactionObject txObject =
                (PromotableTxScopeTransactionObject)status.Transaction;

            try
            {
                txObject.TxScopeAdapter.Dispose();
            }
            catch (Exception e)
            {
                throw new Spring.Transaction.TransactionSystemException("Failure on Transaction Scope rollback.", e);
            }
        }
        protected override void DoCommit(DefaultTransactionStatus status)
        {
            PromotableTxScopeTransactionObject txObject =
                (PromotableTxScopeTransactionObject)status.Transaction;

            try
            {
                txObject.TxScopeAdapter.Complete();
                txObject.TxScopeAdapter.Dispose();
            }
            catch (TransactionAbortedException ex)
            {
                throw new UnexpectedRollbackException("Transaction unexpectedly rolled back (maybe due to a timeout)", ex);
            }
            catch (TransactionInDoubtException ex)
            {
                throw new HeuristicCompletionException(TransactionOutcomeState.Unknown, ex);
            }
            catch (Exception ex)
            {
                throw new TransactionSystemException("Failure on Transaction Scope Commit", ex);
            }
        }
        private void DoTxScopeBegin(PromotableTxScopeTransactionObject txObject, 
                                    Spring.Transaction.ITransactionDefinition definition)
        {

            TransactionScopeOption txScopeOption = CreateTransactionScopeOptions(definition);     
            TransactionOptions txOptions = CreateTransactionOptions(definition);
            txObject.TxScopeAdapter.CreateTransactionScope(txScopeOption, txOptions, definition.EnterpriseServicesInteropOption);            
            
        }