protected override object DoGetTransaction()
        {
            ServiceDomainTransactionObject txObject = new ServiceDomainTransactionObject();

            if (txAdapter != null)
            {
                txObject.ServiceDomainAdapter = txAdapter;
            }
            return(txObject);
        }
        private void DoServiceDomainBegin(ServiceDomainTransactionObject serviceDomainTxObject, ITransactionDefinition definition)
        {
            SimpleServiceConfig serviceConfig = CreateServiceConfig(definition);

            //The context is created when we call Enter.
            serviceDomainTxObject.ServiceDomainAdapter.Enter(serviceConfig);
            if (log.IsDebugEnabled)
            {
                log.Debug("Context created. TransactionId = " + ContextUtil.TransactionId
                          + ", ActivityId = " + ContextUtil.ActivityId);
            }
        }
        protected override bool IsExistingTransaction(object transaction)
        {
            ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)transaction;

            if (txObject.ServiceDomainAdapter.IsInTransaction)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        protected override void DoSetRollbackOnly(DefaultTransactionStatus status)
        {
            ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)status.Transaction;

            if (status.Debug)
            {
                log.Debug("Setting transaction rollback-only");
            }
            try
            {
                txObject.ServiceDomainAdapter.MyTransactionVote = TransactionVote.Abort;
            }
            catch (Exception ex)
            {
                throw new TransactionSystemException("Failure on System.Transactions.Transaction.Current.Rollback", ex);
            }
        }
        protected override void DoBegin(object transaction, ITransactionDefinition definition)
        {
            try
            {
                ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)transaction;

                DoServiceDomainBegin(txObject, definition);
            }
            catch (PlatformNotSupportedException ex)
            {
                throw new TransactionSystemException("ServiceDomain failure on begin of transaction.  Platform does not support EnterpriseServices 'Services without Components'", ex);
            }
            catch (Exception e)
            {
                throw new CannotCreateTransactionException("ServiceDomain failure on begin of transaction", e);
            }
        }
        protected override void DoRollback(DefaultTransactionStatus status)
        {
            ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)status.Transaction;

            if (txObject.ServiceDomainAdapter.IsInTransaction)
            {
                try
                {
                    txObject.ServiceDomainAdapter.SetAbort();
                    txObject.ServiceDomainAdapter.Leave();
                }
                catch (PlatformNotSupportedException ex)
                {
                    throw new TransactionSystemException("Failure on Rollback.  Platform does not support EnterpriseServices 'Services without Components'", ex);
                }
                catch (Exception e)
                {
                    throw new Spring.Transaction.TransactionSystemException("Failure upon Leaving ServiceDomain (for Rollback)", e);
                }
            }
        }
        protected override void DoCommit(DefaultTransactionStatus status)
        {
            ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)status.Transaction;
            bool globalRollbackOnly = status.GlobalRollbackOnly;

            try
            {
                if (txObject.ServiceDomainAdapter.IsInTransaction)
                {
                    if (txObject.ServiceDomainAdapter.MyTransactionVote == TransactionVote.Commit)
                    {
                        txObject.ServiceDomainAdapter.SetComplete();
                    }
                    else
                    {
                        txObject.ServiceDomainAdapter.SetAbort();
                    }
                }
                TransactionStatus serviceDomainTxstatus = txObject.ServiceDomainAdapter.Leave();
                if (log.IsDebugEnabled)
                {
                    log.Debug("ServiceDomain Transaction Status upon leaving ServiceDomain = " + serviceDomainTxstatus);
                }
                txObject.TransactionStatus = serviceDomainTxstatus;
                if (!globalRollbackOnly && serviceDomainTxstatus == TransactionStatus.Aborted)
                {
                    throw new UnexpectedRollbackException("Transaction unexpectedly rolled-back (maybe due to a timeout)");
                }
            }
            catch (PlatformNotSupportedException ex)
            {
                throw new TransactionSystemException("Failure on Commit.  Platform does not support EnterpriseServices 'Services without Components'", ex);
            }
            catch (Exception e)
            {
                throw new TransactionSystemException("Failure upon Leaving ServiceDomain (for Commit)", e);
            }
        }
 private void DoServiceDomainBegin(ServiceDomainTransactionObject serviceDomainTxObject, ITransactionDefinition definition)
 {
     SimpleServiceConfig serviceConfig = CreateServiceConfig(definition);
     //The context is created when we call Enter.
     serviceDomainTxObject.ServiceDomainAdapter.Enter(serviceConfig);
     if (log.IsDebugEnabled)
     {
         log.Debug("Context created. TransactionId = " + ContextUtil.TransactionId
                   + ", ActivityId = " + ContextUtil.ActivityId);
     }
 }
 protected override object DoGetTransaction()
 {
     ServiceDomainTransactionObject txObject = new ServiceDomainTransactionObject();
     if (txAdapter != null)
     {
         txObject.ServiceDomainAdapter = txAdapter;
     }
     return txObject;
 }