public DefaultExtensionsMiddleware(RequestDelegate next, IHostingEnvironment hostingEnv, IOptions <DefaultExtensionsOptions> options, ILoggerFactory loggerFactory)
        {
            if (hostingEnv == null)
            {
                throw new ArgumentNullException(nameof(hostingEnv));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _next         = next ?? throw new ArgumentNullException(nameof(next));
            _fileProvider = hostingEnv.WebRootFileProvider;
            _options      = options.Value;
            _logger       = loggerFactory.CreateLogger <DefaultExtensionsMiddleware>();
        }
Exemple #2
0
        public static IApplicationBuilder UseDefaultExtensions(this IApplicationBuilder app, DefaultExtensionsOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            return(app.UseMiddleware <DefaultExtensionsMiddleware>(Options.Create(options)));
        }