From d902cfb75685e69f49976fd169b7c0ee78251629 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 25 Nov 2025 15:10:05 +0100 Subject: [PATCH] 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. --- src/ReC.Infrastructure/DependencyInjection.cs | 8 ++++++-- src/ReC.Infrastructure/ReC.Infrastructure.csproj | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ReC.Infrastructure/DependencyInjection.cs b/src/ReC.Infrastructure/DependencyInjection.cs index 0ab5890..a9653a0 100644 --- a/src/ReC.Infrastructure/DependencyInjection.cs +++ b/src/ReC.Infrastructure/DependencyInjection.cs @@ -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(configOpt.DbContextOptionsAction); - + + services.AddDbRepository(opt => opt.RegisterFromAssembly(typeof(RecAction).Assembly)); + return services; } diff --git a/src/ReC.Infrastructure/ReC.Infrastructure.csproj b/src/ReC.Infrastructure/ReC.Infrastructure.csproj index 5ce4d9b..04ccbf3 100644 --- a/src/ReC.Infrastructure/ReC.Infrastructure.csproj +++ b/src/ReC.Infrastructure/ReC.Infrastructure.csproj @@ -7,6 +7,7 @@ +