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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user