Skip to content

Instantly share code, notes, and snippets.

@babaktaremi
Last active January 24, 2021 19:28
Show Gist options
  • Save babaktaremi/f561528ebc17253afc303b85c9816332 to your computer and use it in GitHub Desktop.
Save babaktaremi/f561528ebc17253afc303b85c9816332 to your computer and use it in GitHub Desktop.
namespace MediatRExploration.Application.Common
{
public class CommitPostProcessor<TRequest, TResponse> : IRequestPostProcessor<TRequest, TResponse>
{
private readonly ILogger<RequestPostProcessor<TRequest, TResponse>> _logger;
public CommitPostProcessor(ILogger<RequestPostProcessor<TRequest, TResponse>> logger)
{
_logger = logger;
}
public async Task Process(TRequest request, TResponse response, CancellationToken cancellationToken)
{
if (request is ICommitable)
{
//TODO Save Changes to database...DbContext.SaveChanges()
_logger.LogWarning("Saving Changes to the database");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment