Enhance DI with repository registration support

Added `DigitalData.Core.Infrastructure` dependency and updated the `DependencyInjection` class to include `services.AddDbRepository` for dynamic repository registration from the `RecAction` assembly. Updated `ReC.Infrastructure.csproj` to include the new package reference. Improved dependency injection setup for better repository management.
This commit is contained in:
2025-11-25 15:10:05 +01:00
parent cae3ec31c4
commit d902cfb756
2 changed files with 7 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
using Microsoft.EntityFrameworkCore;
using DigitalData.Core.Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using ReC.Domain.Entities;
namespace ReC.Infrastructure;
@@ -14,7 +16,9 @@ public static class DependencyInjection
throw new InvalidOperationException("DbContextOptionsAction must be configured.");
services.AddDbContext<RecDbContext>(configOpt.DbContextOptionsAction);
services.AddDbRepository(opt => opt.RegisterFromAssembly<RecDbContext>(typeof(RecAction).Assembly));
return services;
}

View File

@@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.5.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
</ItemGroup>