public void TestCleanup()
		{
			ICallContext context = CallContextManagerInstance.CallContextOverride;

			ICallContext existingContext = context.ExistingCallContext();
			Correlation.CorrelationEnd();
			context.EndCallContext();
		}
Пример #2
0
        /// <summary>
        /// End a request
        /// </summary>
        private void EndRequest()
        {
            ICallContext context = CallContextManagerInstance.CallContextOverride;

            ICallContext existingContext = context.ExistingCallContext();

            Correlation.CorrelationEnd();
            context.EndCallContext();
        }
Пример #3
0
        /// <summary>
        /// Get the existing call context if there is one
        /// </summary>
        /// <param name="threadId">id of the thread from which to take the context</param>
        /// <returns>the call context that is being used</returns>
        public ICallContext ExistingCallContext(int?threadId = null)
        {
            HttpContext current = HttpContextWrapper.Current;

            if (current != null)
            {
                if (current.Items.ContainsKey(UseBackupKey))
                {
                    return(m_backupCallContext.ExistingCallContext(threadId));
                }

                if (current.Items.ContainsKey(DictionaryKey))
                {
                    return(this);
                }

                return(null);
            }

            return(m_backupCallContext.ExistingCallContext(threadId));
        }
Пример #4
0
        /// <summary>
        /// Get the existing call context if there is one
        /// </summary>
        /// <param name="threadId">id of the thread from which to take the context</param>
        /// <returns>the call context that is being used</returns>
        public ICallContext ExistingCallContext(int? threadId = null)
        {
            OperationContext context = OperationContext.Current;
            if (context != null)
            {
                Stack<Dictionary<string, object>> dataStack;
                if (s_contextData.TryGetValue(context, out dataStack) && dataStack.Count > 0)
                {
                    return this;
                }

                return null;
            }

            return m_backupCallContext.ExistingCallContext(threadId);
        }