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 Microsoft.Extensions.DependencyInjection;
using PARR.Core.Common.Implementations; using PARR.Core.Common.Implementations;
using PARR.Core.Common.Interfaces; using PARR.Core.Common.Interfaces;
using PARR.Domain.Settings;
namespace PARR.Core namespace PARR.Core
{ {
@@ -23,7 +24,10 @@ namespace PARR.Core
// Регим все валидаторы в Core // Регим все валидаторы в Core
services.AddValidatorsFromAssembly(typeof(DependencyInjection).Assembly, includeInternalTypes: true); services.AddValidatorsFromAssembly(typeof(DependencyInjection).Assembly, includeInternalTypes: true);
// Регистрируем сревисы Core // Регим настройки
services.RegisterSettings(configuration);
// --- Регистрируем сревисы Core ---
#region Common #region Common
@@ -53,5 +57,21 @@ namespace PARR.Core
return services; 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;
}
} }
} }

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using PARR.DAL.Settings;
using PARR.Domain.Entities.Base; using PARR.Domain.Entities.Base;
using PARR.Domain.Settings;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;

View File

@@ -2,8 +2,8 @@
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Models.Schedule; using PARR.DAL.Models.Schedule;
using PARR.DAL.Models.Unit; using PARR.DAL.Models.Unit;
using PARR.DAL.Settings;
using PARR.Domain.Entities.Base; using PARR.Domain.Entities.Base;
using PARR.Domain.Settings;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;

View File

@@ -18,8 +18,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
<ProjectReference Include="..\PARR.Common\PARR.Common.csproj" />
<ProjectReference Include="..\PARR.Core\PARR.Core.csproj" /> <ProjectReference Include="..\PARR.Core\PARR.Core.csproj" />
<ProjectReference Include="..\PARR.Domain\PARR.Domain.csproj" /> <ProjectReference Include="..\PARR.Domain\PARR.Domain.csproj" />
</ItemGroup> </ItemGroup>

View File

@@ -23,8 +23,8 @@ using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.Job; using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Schedule; using PARR.DAL.Services.Interfaces.Schedule;
using PARR.DAL.Services.Interfaces.Unit; using PARR.DAL.Services.Interfaces.Unit;
using PARR.DAL.Settings;
using PARR.DAL.TaskServices; using PARR.DAL.TaskServices;
using PARR.Domain.Settings;
namespace PARR.DAL namespace PARR.DAL
{ {
@@ -64,9 +64,9 @@ namespace PARR.DAL
//}); //});
var groupedShortcodesCacheSettings = new GroupedShortcodesCacheSettings(); //var groupedShortcodesCacheSettings = new GroupedShortcodesCacheSettings();
configuration.GetSection(nameof(GroupedShortcodesCacheSettings)).Bind(groupedShortcodesCacheSettings); //configuration.GetSection(nameof(GroupedShortcodesCacheSettings)).Bind(groupedShortcodesCacheSettings);
services.AddSingleton(groupedShortcodesCacheSettings); //services.AddSingleton(groupedShortcodesCacheSettings);
//services.AddSingleton<IRedisCacheService, RedisCacheService>(); //services.AddSingleton<IRedisCacheService, RedisCacheService>();

View File

@@ -1,4 +1,4 @@
namespace PARR.DAL.Settings namespace PARR.Domain.Settings
{ {
public class GroupedShortcodesCacheSettings public class GroupedShortcodesCacheSettings
{ {

View File

@@ -1,9 +1,9 @@
namespace PARR.DAL.Settings namespace PARR.Domain.Settings
{ {
/// <summary> /// <summary>
/// Для использования в моделе, в геттере, ApplicationInWork /// Для использования в моделе, в геттере, ApplicationInWork
/// </summary> /// </summary>
internal static class PrefixSettings public static class PrefixSettings
{ {
/// <summary> /// <summary>
/// Префикс без динамической приставки /// Префикс без динамической приставки

View File

@@ -1,8 +1,4 @@
using PARR.MockData.Data; namespace PARR.MockData
using RabbitMQ.Client;
using System.Text;
namespace PARR.MockData
{ {
internal class EsppDataImporter internal class EsppDataImporter
{ {