Esempio n. 1
0
        internal static Transaction FastGetTransaction(TransactionScope currentScope, ContextData contextData, out Transaction contextTransaction)
        {
            Transaction current = null;

            contextTransaction = null;

            contextTransaction = contextData.CurrentTransaction;

            switch (InteropMode(currentScope))
            {
            case EnterpriseServicesInteropOption.None:

                current = contextTransaction;

                // If there is a transaction in the execution context or if there is a current transaction scope
                // then honer the transaction context.
                if (current == null && currentScope == null)
                {
                    // Otherwise check for an external current.
                    if (TransactionManager.s_currentDelegateSet)
                    {
                        current = TransactionManager.s_currentDelegate();
                    }
                    else
                    {
                        current = EnterpriseServices.GetContextTransaction(contextData);
                    }
                }
                break;

            case EnterpriseServicesInteropOption.Full:
                current = EnterpriseServices.GetContextTransaction(contextData);
                break;

            case EnterpriseServicesInteropOption.Automatic:
                if (EnterpriseServices.UseServiceDomainForCurrent())
                {
                    current = EnterpriseServices.GetContextTransaction(contextData);
                }
                else
                {
                    current = contextData.CurrentTransaction;
                }
                break;
            }

            return(current);
        }