From 272650d991368c480d68da110416555fdbdc43bb Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 10 Sep 2025 17:48:16 +0200 Subject: [PATCH] feat(IRepositoryFactory): create to capsulate repository geenration. - update DbRepo to use IRepositoryFactory --- .../Repository/IRepositoryFactory.cs | 6 ++++++ DigitalData.Core.Infrastructure/DbRepository.cs | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 DigitalData.Core.Abstraction.Application/Repository/IRepositoryFactory.cs diff --git a/DigitalData.Core.Abstraction.Application/Repository/IRepositoryFactory.cs b/DigitalData.Core.Abstraction.Application/Repository/IRepositoryFactory.cs new file mode 100644 index 0000000..8f16160 --- /dev/null +++ b/DigitalData.Core.Abstraction.Application/Repository/IRepositoryFactory.cs @@ -0,0 +1,6 @@ +namespace DigitalData.Core.Abstraction.Application.Repository; + +public interface IRepositoryFactory +{ + public IRepository Get(); +} \ No newline at end of file diff --git a/DigitalData.Core.Infrastructure/DbRepository.cs b/DigitalData.Core.Infrastructure/DbRepository.cs index a27de93..879353b 100644 --- a/DigitalData.Core.Infrastructure/DbRepository.cs +++ b/DigitalData.Core.Infrastructure/DbRepository.cs @@ -79,12 +79,12 @@ public class DbRepository : IRepository where TDbC public class DbRepository : IRepository { - private readonly IServiceProvider _provider; + private readonly IRepositoryFactory _factory; - public DbRepository(IServiceProvider provider) + public DbRepository(IRepositoryFactory factory) { - _provider = provider; + _factory = factory; } - public IRepository Entity() => _provider.GetRequiredService>(); + public IRepository Entity() => _factory.Get(); } \ No newline at end of file