/// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public void BeginRequest(object context)
        {
            var environment  = System.Web.HttpContext.Current.Request.ServerVariables;
            var scopeContext = new RequestScopeContext(environment);

            RequestScopeContext.InitCurrent(scopeContext);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="environment"></param>
        /// <returns></returns>
        public async Task Invoke(IDictionary <string, object> environment)
        {
            var scopeContext = new RequestScopeContext(environment);

            RequestScopeContext.InitCurrent(scopeContext);

            try
            {
                await next(environment);
            }
            finally
            {
                RequestScopeContext.FreeContextSlot();
            }
        }