示例#1
0
 public void Add(IMiddleWare <T> middleWare)
 {
     MiddleWares.Add(async(s, next) =>
     {
         await middleWare.DealWith(s, next);
     });
 }
        public DelegateMiddleWare Build()
        {
            DelegateMiddleWare first = null;

            while (types.Count > 0)
            {
                IMiddleWare mw = Activator.CreateInstance(types.Pop(), first) as IMiddleWare;

                first = mw.InvokeAsync;
            }

            return(first);
        }
示例#3
0
 public void UseMiddleWare(IMiddleWare middleWare, IDataSerializer serializer, ILogger logger = null)
 {
     _queue      = middleWare;
     _serializer = serializer;
     _logger     = logger;
 }
示例#4
0
 public void use(IMiddleWare Ware)
 {
     middleWare.Add(Ware);
 }