Esempio n. 1
0
        public static IMvcCoreBuilder AddModularRazorPages(this IMvcCoreBuilder builder)
        {
            builder.AddRazorPages();

            builder.Services.TryAddEnumerable(
                ServiceDescriptor.Transient <IConfigureOptions <RazorPagesOptions>, ModularPageRazorPagesOptionsSetup>());

            builder.Services.TryAddEnumerable(
                ServiceDescriptor.Singleton <IPageApplicationModelProvider, ModularPageApplicationModelProvider>());

            return(builder);
        }
        /// <summary>
        /// Adds PineBlog Razor Pages services to the services collection.
        /// </summary>
        /// <param name="builder">The Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder.</param>
        public static IMvcCoreBuilder AddPineBlogRazorPages(this IMvcCoreBuilder builder)
        {
            ConfigureServices(builder.Services);

            builder.AddApplicationPart(typeof(Controllers.FileController).Assembly);
            builder.AddRazorPages(SetRazorPagesOptions);
            builder.AddMvcOptions(options =>
            {
                options.Filters.Add <PineBlogViewDataAsyncPageFilter>();
            });
            builder.AddFluentValidation();

            return(builder);
        }
Esempio n. 3
0
        public static IMvcCoreBuilder AddModularRazorPages(this IMvcCoreBuilder builder)
        {
            builder.AddRazorPages(options =>
            {
                options.RootDirectory = "/";
                options.Conventions.Add(new DefaultModularPageRouteModelConvention());
            });

            builder.Services.TryAddEnumerable(
                ServiceDescriptor.Transient <IConfigureOptions <RazorViewEngineOptions>, ModularPageRazorViewEngineOptionsSetup>());

            builder.Services.TryAddEnumerable(
                ServiceDescriptor.Singleton <IPageApplicationModelProvider, ModularPageApplicationModelProvider>());

            return(builder);
        }
Esempio n. 4
0
        public static IMvcCoreBuilder AddModularRazorPages(this IMvcCoreBuilder builder)
        {
            builder.AddRazorPages(options =>
            {
                options.RootDirectory = "/Packages";
                options.Conventions.Add(new ModularPageRouteModelConvention());
            });

            builder.Services.TryAddEnumerable(
                ServiceDescriptor.Singleton <IPageApplicationModelProvider, ModularPageApplicationModelProvider>());

            builder.Services.Replace(
                ServiceDescriptor.Singleton <IActionDescriptorChangeProvider, ModularPageActionDescriptorChangeProvider>());

            return(builder);
        }
Esempio n. 5
0
        /// <summary>
        /// Adds PineBlog Razor Pages services to the services collection.
        /// </summary>
        /// <param name="builder">The Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder.</param>
        public static IMvcCoreBuilder AddPineBlogRazorPages(this IMvcCoreBuilder builder)
        {
            ConfigureServices(builder.Services);

            builder.AddApplicationPart(typeof(Controllers.FileController).Assembly);
            builder.AddRazorPages(option =>
            {
                option.Conventions.AuthorizeAreaFolder("Admin", "/");
                option.Conventions.AddAreaPageRoute("Blog", "/Post", PineBlogConstants.BlogAreaPath + "/{*slug}");
            });
            builder.AddMvcOptions(options =>
            {
                options.Filters.Add <PineBlogViewDataAsyncPageFilter>();
            });
            builder.AddFluentValidation();

            return(builder);
        }
 public static IMvcCoreBuilder AddModularRazorPages(this IMvcCoreBuilder builder)
 {
     builder.AddRazorPages();
     builder.Services.AddModularRazorPages();
     return(builder);
 }