コード例 #1
0
        public static void RestoreFlow()
        {
            Thread           currentThread    = Thread.CurrentThread;
            ExecutionContext executionContext = currentThread.ExecutionContext;

            if (executionContext == null || !executionContext.m_isFlowSuppressed)
            {
                throw new InvalidOperationException(SR.InvalidOperation_CannotRestoreUnsupressedFlow);
            }

            currentThread.ExecutionContext = executionContext.ShallowClone(isFlowSuppressed: false);
        }
コード例 #2
0
        public static void RestoreFlow()
        {
            Thread           currentThread    = Thread.CurrentThread;
            ExecutionContext executionContext = currentThread.ExecutionContext;

            if (executionContext == null || !executionContext.m_isFlowSuppressed)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotRestoreUnsupressedFlow"));
            }
            Contract.EndContractBlock();

            currentThread.ExecutionContext = executionContext.ShallowClone(isFlowSuppressed: false);
        }
コード例 #3
0
        public static AsyncFlowControl SuppressFlow()
        {
            Thread           currentThread    = Thread.CurrentThread;
            ExecutionContext executionContext = currentThread.ExecutionContext ?? Default;

            if (executionContext.m_isFlowSuppressed)
            {
                throw new InvalidOperationException(SR.InvalidOperation_CannotSupressFlowMultipleTimes);
            }

            executionContext = executionContext.ShallowClone(isFlowSuppressed: true);
            var asyncFlowControl = new AsyncFlowControl();

            currentThread.ExecutionContext = executionContext;
            asyncFlowControl.Initialize(currentThread);
            return(asyncFlowControl);
        }
コード例 #4
0
        public static AsyncFlowControl SuppressFlow()
        {
            Thread           currentThread    = Thread.CurrentThread;
            ExecutionContext executionContext = currentThread.ExecutionContext ?? Default;

            if (executionContext.m_isFlowSuppressed)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotSupressFlowMultipleTimes"));
            }
            Contract.EndContractBlock();

            executionContext = executionContext.ShallowClone(isFlowSuppressed: true);
            var asyncFlowControl = new AsyncFlowControl();

            currentThread.ExecutionContext = executionContext;
            asyncFlowControl.Initialize(currentThread);
            return(asyncFlowControl);
        }