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

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

            _hostingEnvironment = hostingEnvironment;
            _renderer           = renderer;
            _opts = opts;
        }
예제 #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>();
        }
예제 #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>();
        }