refactor: replace internal UnitOfWork with NotificationUnitOfWork and NotificationBaseRepository

- Consolidate unit of work implementation with NotificationUnitOfWork.
- Refactor repositories to use NotificationBaseRepository for consistency.
- Simplify request handlers by removing IUnitOfWork dependency.
- Update related tests and service registration.
This commit is contained in:
Anatolii Grynchuk
2026-05-13 02:08:43 +03:00
parent b4d8497ea7
commit 50828d23ec
32 changed files with 276 additions and 186 deletions
@@ -0,0 +1,20 @@
namespace HrynCo.NotificationService.DAL.EF.Core;
using HrynCo.DAL.Abstract.Entities;
using HrynCo.DAL.EF.Core;
public abstract class NotificationBaseRepository<TEntity>
: BaseRepository<NotificationEfRepository<TEntity>, NotificationDbContext, TEntity, Guid> where TEntity : Entity
{
protected NotificationBaseRepository(NotificationDbContext dbContext)
{
DbContext = dbContext;
}
private NotificationDbContext DbContext { get; set; }
protected override NotificationEfRepository<TEntity> CreateEfRepository()
{
return new NotificationEfRepository<TEntity>(DbContext);
}
}
@@ -0,0 +1,13 @@
namespace HrynCo.NotificationService.DAL.EF.Core;
using HrynCo.DAL.Abstract.Entities;
using HrynCo.DAL.EF.Core;
public class NotificationEfRepository<TEntity> : BaseEfRepository<NotificationDbContext, TEntity, Guid>
where TEntity : class, IEntity<Guid>
{
public NotificationEfRepository(NotificationDbContext dbContext) :
base(dbContext)
{
}
}
@@ -1,10 +0,0 @@
using HrynCo.DAL.EF.Core;
namespace HrynCo.NotificationService.DAL.EF.Core;
internal sealed class UnitOfWork : EfUnitOfWork<NotificationDbContext>
{
public UnitOfWork(NotificationDbContext context) : base(context)
{
}
}