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:
@@ -1,4 +1,3 @@
|
||||
using HrynCo.DAL.Abstract;
|
||||
using HrynCo.NotificationService.Services.Logging;
|
||||
using MediatR;
|
||||
using Serilog;
|
||||
@@ -8,14 +7,12 @@ namespace HrynCo.NotificationService.Services.Core;
|
||||
public abstract class RequestHandler<TRequest, TResponse> : IRequestHandler<TRequest, TResponse>
|
||||
where TRequest : IRequest<TResponse>
|
||||
{
|
||||
protected RequestHandler(IContextualSerilogLogger<TRequest> logger, IUnitOfWork unitOfWork)
|
||||
protected RequestHandler(IContextualSerilogLogger<TRequest> logger)
|
||||
{
|
||||
Logger = logger.Logger;
|
||||
UnitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
protected ILogger Logger { get; }
|
||||
protected IUnitOfWork UnitOfWork { get; }
|
||||
|
||||
public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -23,4 +20,4 @@ public abstract class RequestHandler<TRequest, TResponse> : IRequestHandler<TReq
|
||||
}
|
||||
|
||||
protected abstract Task<TResponse> DoOnHandle(TRequest request, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user