Files
hrynco-notification-service/HrynCo.NotificationService.Services/Core/RequestHandler.cs
T
Anatolii Grynchuk 50828d23ec 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.
2026-05-13 02:08:43 +03:00

24 lines
696 B
C#

using HrynCo.NotificationService.Services.Logging;
using MediatR;
using Serilog;
namespace HrynCo.NotificationService.Services.Core;
public abstract class RequestHandler<TRequest, TResponse> : IRequestHandler<TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
protected RequestHandler(IContextualSerilogLogger<TRequest> logger)
{
Logger = logger.Logger;
}
protected ILogger Logger { get; }
public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken)
{
return DoOnHandle(request, cancellationToken);
}
protected abstract Task<TResponse> DoOnHandle(TRequest request, CancellationToken cancellationToken);
}