ee4c988a0d
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
26 lines
825 B
C#
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);
|
|
} |