public static IMiddlewarePipeline Add(this IMiddlewarePipeline pipeline, NextDelegate method) { if (pipeline == null) { throw new ArgumentNullException(nameof(pipeline)); } if (method == null) { throw new ArgumentNullException(nameof(method)); } pipeline.AddLast(new DelegateMiddleware(method)); return(pipeline); }
public static IMiddlewarePipeline AddMvc(this IMiddlewarePipeline pipeline, IRouter router) { if (pipeline == null) { throw new ArgumentNullException(nameof(pipeline)); } if (router == null) { throw new ArgumentNullException(nameof(router)); } var middleware = new MvcMiddleware(router); pipeline.AddLast(middleware); return(pipeline); }
public static IMiddlewarePipeline AddMvc(this IMiddlewarePipeline pipeline, IServiceProvider provider) { if (pipeline == null) { throw new ArgumentNullException(nameof(pipeline)); } if (provider == null) { throw new ArgumentNullException(nameof(provider)); } var router = provider.GetService <IRouter>(); var middleware = new MvcMiddleware(router); pipeline.AddLast(middleware); return(pipeline); }