System.Transactions.Transaction.InteropMode C# (CSharp) Method

InteropMode() static private method

static private InteropMode ( TransactionScope currentScope ) : EnterpriseServicesInteropOption
currentScope TransactionScope
return EnterpriseServicesInteropOption
        internal static EnterpriseServicesInteropOption InteropMode(TransactionScope currentScope)
        {
            if (currentScope != null)
            {
                return currentScope.InteropMode;
            }

            return EnterpriseServicesInteropOption.None;
        }

Usage Example

Example #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;
        }
All Usage Examples Of System.Transactions.Transaction::InteropMode