public ResourceLoaderMiddleware(RequestDelegate next, IOptions <WebControlsOptions> optionsAccessor) { this.Options = optionsAccessor.Value; this.Next = next; this.Loader = new ResourceLoader(this.Options); this.ContentTypeProvider = new FileExtensionContentTypeProvider(); }
public ResourceLoader(WebControlsOptions options) { this.Options = options; List <IFileProvider> embeddedFileProviders = new List <IFileProvider>(); foreach (var controlLibrary in this.Options.ControlLibraries) { embeddedFileProviders.Add(new EmbeddedFileProvider(controlLibrary)); } this.FileProvider = new CompositeFileProvider(embeddedFileProviders); }
private static void PopulateWebControlsOptionsOnce(HttpContext httpContext) { if (null == WebControlsUrlExtensions.WebControlsOptions) { lock (WebControlsUrlExtensions.SyncLock) { if (null == WebControlsUrlExtensions.WebControlsOptions) { var optionsAccessor = httpContext.RequestServices.GetService <IOptions <WebControlsOptions> >(); WebControlsUrlExtensions.WebControlsOptions = optionsAccessor?.Value ?? new WebControlsOptions(); WebControlsUrlExtensions.UrlHelperFactory = httpContext.RequestServices.GetService <IUrlHelperFactory>(); } } } }
public DefaultControlRenderer(IServiceProvider serviceProvider, IOptions <WebControlsRendererOptions> rendererOptionsAccessor, IOptions <WebControlsOptions> optionsAccessor) { this.ServiceProvider = serviceProvider; this.Options = optionsAccessor.Value; this.RendererOptions = rendererOptionsAccessor.Value; }