Example #1
0
        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);
        }
Example #2
0
        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);
        }