2021-11-26 12:31:33 +01:00
|
|
|
using Microsoft.Extensions.Configuration;
|
2021-11-24 15:49:25 +01:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2021-11-23 22:56:22 +01:00
|
|
|
|
|
|
|
|
namespace zero.Pages;
|
|
|
|
|
|
2021-11-30 14:32:10 +01:00
|
|
|
public class PagesModule : ZeroModule
|
2021-11-23 22:56:22 +01:00
|
|
|
{
|
2021-11-30 14:32:10 +01:00
|
|
|
public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
|
2021-11-23 22:56:22 +01:00
|
|
|
{
|
2021-11-24 13:56:08 +01:00
|
|
|
services.AddScoped<IPagesStore, PagesStore>();
|
|
|
|
|
services.AddScoped<IPageTypeService, PageTypeService>();
|
2021-11-26 12:31:33 +01:00
|
|
|
services.AddScoped<IPageModuleTypeService, PageModuleTypeService>();
|
2021-11-24 13:56:08 +01:00
|
|
|
|
2021-11-30 14:32:10 +01:00
|
|
|
services.AddOptions<PageOptions>().Bind(configuration.GetSection("Zero:Pages"));
|
|
|
|
|
services.AddOptions<PageModuleOptions>().Bind(configuration.GetSection("Zero:PageModules"));
|
2021-11-24 15:49:25 +01:00
|
|
|
|
2021-12-02 13:43:04 +01:00
|
|
|
services.Configure<RavenOptions>(opts =>
|
2021-11-23 22:56:22 +01:00
|
|
|
{
|
2021-12-02 13:43:04 +01:00
|
|
|
opts.Indexes.Add<Pages_AsHistory>();
|
|
|
|
|
opts.Indexes.Add<Pages_ByHierarchy>();
|
|
|
|
|
opts.Indexes.Add<Pages_ByType>();
|
|
|
|
|
opts.Indexes.Add<Pages_WithChildren>();
|
|
|
|
|
});
|
2021-11-24 14:37:32 +01:00
|
|
|
|
2021-12-02 13:43:04 +01:00
|
|
|
services.Configure<FlavorOptions>(opts =>
|
|
|
|
|
{
|
|
|
|
|
opts.Provide<Page>();
|
|
|
|
|
opts.Add<Page, PageFolder>(Constants.Pages.FolderAlias, "@page.folder.name", "@page.folder.description", "fth-folder");
|
2021-11-23 22:56:22 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|