Exemplo n.º 1
0
        /// <summary>
        /// 调用。
        /// </summary>
        /// <param name="context">处理上下文。</param>
        /// <returns>任务。</returns>
        public override Task Invoke(IHandlerContext context)
        {
            _sessionCollection = context.GetDependencyResolver().GetService <IUserSessionCollection>();

            var requestMessage = context.GetRequestMessage();

            //设置用户会话。
            context.SetSession(_sessionCollection.GetOrAdd(requestMessage.FromUserName));

            return(Next.Invoke(context));
        }
        /// <summary>
        /// 调用。
        /// </summary>
        /// <param name="context">处理上下文。</param>
        /// <returns>任务。</returns>
        public override Task Invoke(IHandlerContext context)
        {
            _sessionCollection = context.GetDependencyResolver().GetService<IUserSessionCollection>();

            var requestMessage = context.GetRequestMessage();
            //设置用户会话。
            context.SetSession(_sessionCollection.GetOrAdd(requestMessage.FromUserName));

            return Next.Invoke(context);
        }