public WebPagesRouter(IHostingEnvironment hostingEnvironment, RazorViewToStringRenderer renderer, WebPagesOptions opts)
        {
            if (opts == null) throw new ArgumentNullException(nameof(opts));

            _hostingEnvironment = hostingEnvironment;
            _renderer = renderer;
            _opts = opts;
        }
Beispiel #2
0
        public WebPagesRouter(IHostingEnvironment hostingEnvironment, RazorViewToStringRenderer renderer, WebPagesOptions opts)
        {
            if (opts == null)
            {
                throw new ArgumentNullException(nameof(opts));
            }

            _hostingEnvironment = hostingEnvironment;
            _renderer           = renderer;
            _opts = opts;
        }
Beispiel #3
0
        public WebPagesRouter(IHostingEnvironment hostingEnvironment, RazorViewToStringRenderer renderer, WebPagesOptions opts, IRazorViewEngineFileProviderAccessor fileProviderAccessor)
        {
            if (opts == null)
            {
                throw new ArgumentNullException(nameof(opts));
            }

            _hostingEnvironment = hostingEnvironment;
            _renderer           = renderer;
            _opts = opts;
            _fileProviderAccessor = fileProviderAccessor;
        }
        public static void AddWebPages(this IServiceCollection services, WebPagesOptions webPagesOptions)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddMvcCore().AddRazorViewEngine(o =>
            {
                o.ViewLocationFormats.Clear();
                o.ViewLocationFormats.Add("/" + webPagesOptions.ViewsFolderName + "/{0}" + RazorViewEngine.ViewExtension);
            });

            services.AddSingleton<WebPagesOptions>(webPagesOptions);
            services.AddSingleton<RazorViewToStringRenderer>();
            services.AddSingleton<WebPagesRouter>();
        }
Beispiel #5
0
        public static void AddWebPages(this IServiceCollection services, WebPagesOptions webPagesOptions)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddMvcCore().AddRazorViewEngine(o =>
            {
                o.ViewLocationFormats.Clear();
                o.ViewLocationFormats.Add("/" + webPagesOptions.ViewsFolderName + "/{0}" + RazorViewEngine.ViewExtension);
            });

            services.AddSingleton <WebPagesOptions>(webPagesOptions);
            services.AddSingleton <RazorViewToStringRenderer>();
            services.AddSingleton <WebPagesRouter>();
        }