feat: Вынесены настройки из dal
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using PARR.Core.Common.Implementations;
|
||||
using PARR.Core.Common.Interfaces;
|
||||
using PARR.Domain.Settings;
|
||||
|
||||
namespace PARR.Core
|
||||
{
|
||||
@@ -23,7 +24,10 @@ namespace PARR.Core
|
||||
// Регим все валидаторы в Core
|
||||
services.AddValidatorsFromAssembly(typeof(DependencyInjection).Assembly, includeInternalTypes: true);
|
||||
|
||||
// Регистрируем сревисы Core
|
||||
// Регим настройки
|
||||
services.RegisterSettings(configuration);
|
||||
|
||||
// --- Регистрируем сревисы Core ---
|
||||
|
||||
#region Common
|
||||
|
||||
@@ -53,5 +57,21 @@ namespace PARR.Core
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Регистрация настроек
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="configuration"></param>
|
||||
/// <returns></returns>
|
||||
private static IServiceCollection RegisterSettings(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
var groupedShortcodesCacheSettings = new GroupedShortcodesCacheSettings();
|
||||
configuration.GetSection(nameof(GroupedShortcodesCacheSettings)).Bind(groupedShortcodesCacheSettings);
|
||||
services.AddSingleton(groupedShortcodesCacheSettings);
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user