Files
mixtape/zero.Backoffice/Modules/ServiceCollectionExtensions.cs
T

36 lines
1.1 KiB
C#
Raw Normal View History

2021-11-29 00:38:55 +01:00
using AutoMapper;
using Microsoft.Extensions.Configuration;
2021-11-26 15:47:11 +01:00
using Microsoft.Extensions.DependencyInjection;
using zero.Backoffice.Modules.Countries;
2021-11-27 16:33:05 +01:00
using zero.Backoffice.Modules.Pages;
using zero.Backoffice.Modules.Search;
2021-11-26 15:47:11 +01:00
namespace zero.Backoffice.Modules;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddZeroBackofficeModules(this IServiceCollection services, IConfiguration config)
{
services.AddScoped<IPageTreeService, PageTreeService>();
2021-11-27 16:33:05 +01:00
services.AddScoped<IBackofficeSearchService, BackofficeSearchService>();
2021-11-26 15:47:11 +01:00
2021-11-27 16:09:02 +01:00
services.AddScoped<IPickerProvider<Country>, CountryPickerProvider>();
2021-11-27 00:59:27 +01:00
services.AddSingleton<IPermissionProvider, CountryPermissions>();
2021-11-26 15:47:11 +01:00
services.Configure<RavenOptions>(opts =>
{
opts.Indexes.Add<zero_Backoffice_Countries_Listing>();
2021-11-27 16:33:05 +01:00
opts.Indexes.Add<zero_Backoffice_Search>();
2021-11-26 15:47:11 +01:00
});
2021-11-29 00:38:55 +01:00
services.Configure<BackofficeOptions>(opts =>
{
opts.Mapper.Configure(maps =>
{
maps.AddProfile<CountryMapperProfile>();
});
});
2021-11-26 15:47:11 +01:00
return services;
}
}