Files
hrynco-notification-service/HrynCo.NotificationService.Services/Core/RequestHandler.cs
T
Anatolii Grynchuk ee4c988a0d refactor: replace local dal abstractions with hrynco-ef packages
Remove duplicate IEntity, Entity, ITransaction, IUnitOfWork, EfRepository,
EfUnitOfWork, EfTransactionAdapter — now consumed from HrynCo.DAL.Abstract
and HrynCo.DAL.EF packages (1.0.1).

Ref: IT-0
2026-05-05 20:39:06 +03:00

26 lines
825 B
C#

using HrynCo.DAL.Abstract;
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, IUnitOfWork unitOfWork)
{
Logger = logger.Logger;
UnitOfWork = unitOfWork;
}
protected ILogger Logger { get; }
protected IUnitOfWork UnitOfWork { get; }
public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken)
{
return DoOnHandle(request, cancellationToken);
}
protected abstract Task<TResponse> DoOnHandle(TRequest request, CancellationToken cancellationToken);
}