示例#1
0
 public MiddlewareInjectorMiddleware(RequestDelegate next, IApplicationBuilder builder, MiddlewareInjectorOptions options)
 {
     _next    = next ?? throw new ArgumentNullException(nameof(next));
     _builder = builder ?? throw new ArgumentNullException(nameof(builder));
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
示例#2
0
        public static IApplicationBuilder UseMiddlewareInjector(this IApplicationBuilder builder, MiddlewareInjectorOptions options)
        {
            var result = builder.UseMiddleware <MiddlewareInjectorMiddleware>(builder.New(), options);

            //register the sources during startup
            options.InjectMiddleware(app =>
            {
                Startup.RegisterSources(app);
            });

            return(result);
        }