コード例 #1
0
        /// <summary>
        /// Gets the context in the thread
        /// </summary>
        /// <returns>the NHContext</returns>
        protected static NHContext GetNHContext()
        {
            NHContext context = HttpContext.Current.Items[NH_CONTEXT_CALL_CONTEXT_KEY] as NHContext;

            string contextString = "null";

            if (context != null)
            {
                contextString = context.ToString();
            }

            log.Debug("NHWebContext value:" + contextString);
            if (context == null)
            {
                log.Debug("No context found, creating a new one on thread " + AppDomain.GetCurrentThreadId().ToString());
                context = new NHWebContext();
                SetNHContext(context);
            }
            else
            {
                log.Debug("Context found on thread " + AppDomain.GetCurrentThreadId().ToString());
            }

            return(context);
        }
コード例 #2
0
        /// <summary>
        /// Gets the context in the thread
        /// </summary>
        /// <returns>the NHContext</returns>
        protected static NHContext GetNHContext()
        {
            NHContext context = HttpContext.Current.Items[NH_CONTEXT_CALL_CONTEXT_KEY] as NHContext;

            string contextString = "null";
            if (context != null) {
                contextString = context.ToString();
            }

            log.Debug("NHWebContext value:" + contextString);
            if (context == null) {
                log.Debug("No context found, creating a new one on thread " + AppDomain.GetCurrentThreadId().ToString());
                context = new NHWebContext();
                SetNHContext(context);
            } else {
                log.Debug("Context found on thread " + AppDomain.GetCurrentThreadId().ToString());
            }

            return context;
        }