public static void AddAuthendication(this ServiceBuilder s, string extraPara)
        {
            //Console.WriteLine(extraPara);
            s.Use(next =>
            {
                return(context =>
                {
                    AuthendicationMiddleware middleware = new AuthendicationMiddleware(next);
                    middleware.Invoke(context, extraPara);
                    return Task.CompletedTask;
                });
            }

                  );
        }
Exemple #2
0
        static void UseCustomMiddleWare(string aa)
        {
            //RequestDelegate next1 = context1 => { string ss = ""; return Task.CompletedTask; };
            //RequestDelegate r = context1 =>
            //{
            //    CustomMiddleware middleware = new CustomMiddleware(next1);
            //    Task t = middleware.Invoke(context1, " this is extra middleware");
            //    return t;
            //};



            _serviceBuilder.Use(next =>
                                context => {
                AuthendicationMiddleware middleware = new AuthendicationMiddleware(next);
                return(middleware.Invoke(context, aa));
            }
                                );
        }