feat(Repositories.DependencyInjection): add config, controlTf, state and button repositories with auto-mapper configurations.

This commit is contained in:
tekh 2025-07-30 15:00:05 +02:00
parent d0e306b7e4
commit 5466b35b95
2 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,12 @@
using Microsoft.Extensions.DependencyInjection; using DigitalData.Core.Infrastructure;
using DigitalData.Core.Infrastructure.AutoMapper;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
using WorkFlow.Application.Contracts.Repositories; using WorkFlow.Application.Contracts.Repositories;
using WorkFlow.Application.Dto.Config;
using WorkFlow.Application.Dto.ProfileControlsTF;
using WorkFlow.Application.Dto.State;
using WorkFlow.Domain.Entities;
using WorkFlow.Infrastructure.Repositories; using WorkFlow.Infrastructure.Repositories;
namespace WorkFlow.Infrastructure; namespace WorkFlow.Infrastructure;
@ -9,13 +15,18 @@ public static class DependencyInjection
{ {
public static IServiceCollection AddWorkFlowRepositories(this IServiceCollection services) public static IServiceCollection AddWorkFlowRepositories(this IServiceCollection services)
{ {
services.TryAddScoped<IConfigRepository, ConfigRepository>();
services.TryAddScoped<IProfileControlsTFRepository, ProfileControlsTFRepository>(); services.TryAddScoped<IProfileControlsTFRepository, ProfileControlsTFRepository>();
services.TryAddScoped<IProfileObjStateRepository, ProfileObjStateRepository>(); services.TryAddScoped<IProfileObjStateRepository, ProfileObjStateRepository>();
services.TryAddScoped<IProfileRepository, ProfileRepository>(); services.TryAddScoped<IProfileRepository, ProfileRepository>();
services.TryAddScoped<IProfileObjRepository, ProfileObjRepository>(); services.TryAddScoped<IProfileObjRepository, ProfileObjRepository>();
services.TryAddScoped<IStateRepository, StateRepository>(); services.TryAddScoped<IStateRepository, StateRepository>();
services.TryAddScoped<IButtonRepository, ButtonRepository>(); services.TryAddScoped<IButtonRepository, ButtonRepository>();
services.AddDbRepository<WFDBContext, Config>(c => c.Configs).UseAutoMapper(typeof(ConfigUpdateDto));
services.AddDbRepository<WFDBContext, ProfileControlsTF>(c => c.ProfileControlsTFs).UseAutoMapper(typeof(ProfileControlsTFUpdateDto));
services.AddDbRepository<WFDBContext, State>(c => c.States).UseAutoMapper(typeof(StateUpdateDto));
services.AddDbRepository<WFDBContext, Button>(c => c.Buttons).UseAutoMapper();
return services; return services;
} }
} }

View File

@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.0.0" /> <PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.1.1" /> <PackageReference Include="DigitalData.Core.Infrastructure" Version="2.1.1" />
<PackageReference Include="DigitalData.Core.Infrastructure.AutoMapper" Version="1.0.3" />
<PackageReference Include="UserManager" Version="1.1.2" /> <PackageReference Include="UserManager" Version="1.1.2" />
</ItemGroup> </ItemGroup>