feat: Вынесены настройки из dal

This commit is contained in:
Mikhail Trubnikov
2026-04-14 16:42:15 +10:00
parent 188ebc20a0
commit 50358fd5bd
8 changed files with 31 additions and 17 deletions

View File

@@ -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;
}
}
}