fix: removido classes

This commit is contained in:
Jean Gatto
2022-06-07 21:58:51 -03:00
parent 83bcfca95c
commit b427b056b0
2 changed files with 0 additions and 41 deletions
@@ -1,26 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using MediatR;
using Microsoft.Extensions.Logging;
namespace Shop.Core.Behaviors;
public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>
{
private readonly ILogger<LoggingBehavior<TRequest, TResponse>> _logger;
public LoggingBehavior(ILogger<LoggingBehavior<TRequest, TResponse>> logger) => _logger = logger;
public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
{
var commandName = request.GetType().Name;
_logger.LogInformation("----- Handling command {CommandName} ({@Command})", commandName, request);
var response = await next();
_logger.LogInformation("----- Command {CommandName} handled - response: {@Response}", commandName, response);
return response;
}
}
-15
View File
@@ -1,15 +0,0 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Shop.Core.Interfaces;
public interface IUnitOfWork : IDisposable
{
/// <summary>
/// Salva todas as alterações feitas no contexto do banco de dados.
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns>O número de linhas afetadas no banco de dados.</returns>
Task<int> CommitAsync(CancellationToken cancellationToken = default);
}