InteropMode() static private method

static private InteropMode ( TransactionScope currentScope ) : EnterpriseServicesInteropOption
currentScope TransactionScope
return EnterpriseServicesInteropOption
Exemplo n.º 1
0
        // PushScope
        //
        // Push a transaction scope onto the stack.
        private void PushScope()
        {
            // Fixup the interop mode before we set current.
            if (!_interopModeSpecified)
            {
                // Transaction.InteropMode will take the interop mode on
                // for the scope in currentScope into account.
                _interopOption = Transaction.InteropMode(_savedCurrentScope);
            }

            // async function yield at await points and main thread can continue execution. We need to make sure the TLS data are restored appropriately.
            SaveTLSContextData();

            if (AsyncFlowEnabled)
            {
                // Async Flow is enabled and CallContext will be used for ambient transaction.
                _threadContextData = CallContextCurrentData.CreateOrGetCurrentData(ContextKey);

                if (_savedCurrentScope == null && _savedCurrent == null)
                {
                    // Clear TLS data so that transaction doesn't leak from current thread.
                    ContextData.TLSCurrentData = null;
                }
            }
            else
            {
                // Legacy TransactionScope. Use TLS to track ambient transaction context.
                _threadContextData = ContextData.TLSCurrentData;
                CallContextCurrentData.ClearCurrentData(ContextKey, false);
            }

            // This call needs to be done first
            SetCurrent(_expectedCurrent);
            _threadContextData.CurrentScope = this;
        }
 private void PushScope()
 {
     if (!this.interopModeSpecified)
     {
         this.interopOption = Transaction.InteropMode(this.savedCurrentScope);
     }
     this.SetCurrent(this.expectedCurrent);
     this.threadContextData.CurrentScope = this;
 }
Exemplo n.º 3
0
        // The validate method assumes that the existing parent ambient transaction scope is already looked up.
        private void ValidateAsyncFlowOptionAndESInteropOption()
        {
            if (AsyncFlowEnabled)
            {
                EnterpriseServicesInteropOption currentInteropOption = _interopOption;
                if (!_interopModeSpecified)
                {
                    // Transaction.InteropMode will take the interop mode on
                    // for the scope in currentScope into account.
                    currentInteropOption = Transaction.InteropMode(_savedCurrentScope);
                }

                if (currentInteropOption != EnterpriseServicesInteropOption.None)
                {
                    throw new NotSupportedException(SR.AsyncFlowAndESInteropNotSupported);
                }
            }
        }