Ejemplo n.º 1
0
        // SetCurrent
        //
        // Place the given value in current by whatever means necessary for interop mode.
        private void SetCurrent(Transaction newCurrent)
        {
            // Keep a dependent clone of current if we don't have one and we are not committable
            if (_dependentTransaction == null && _committableTransaction == null)
            {
                if (newCurrent != null)
                {
                    _dependentTransaction = newCurrent.DependentClone(DependentCloneOption.RollbackIfNotComplete);
                }
            }

            switch (_interopOption)
            {
            case EnterpriseServicesInteropOption.None:
                _threadContextData.CurrentTransaction = newCurrent;
                break;

            case EnterpriseServicesInteropOption.Automatic:
                EnterpriseServices.VerifyEnterpriseServicesOk();
                if (EnterpriseServices.UseServiceDomainForCurrent())
                {
                    EnterpriseServices.PushServiceDomain(newCurrent);
                }
                else
                {
                    _threadContextData.CurrentTransaction = newCurrent;
                }
                break;

            case EnterpriseServicesInteropOption.Full:
                EnterpriseServices.VerifyEnterpriseServicesOk();
                EnterpriseServices.PushServiceDomain(newCurrent);
                break;
            }
        }