diff --git a/Directory.Packages.props b/Directory.Packages.props index a3174ae..ebb6ee0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,10 +4,10 @@ - - - - + + + + @@ -29,7 +29,7 @@ - + @@ -39,4 +39,4 @@ - \ No newline at end of file + diff --git a/HrynCo.NotificationService.Services/Behaviors/TransactionBehavior.cs b/HrynCo.NotificationService.Services/Behaviors/TransactionBehavior.cs index 1939570..87290a3 100644 --- a/HrynCo.NotificationService.Services/Behaviors/TransactionBehavior.cs +++ b/HrynCo.NotificationService.Services/Behaviors/TransactionBehavior.cs @@ -18,11 +18,15 @@ public class TransactionBehavior : IPipelineBehavior Handle(TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken) => _profiler.MeasureExecutionAsync( - () => _unitOfWork.ExecuteInTransactionAsync(async () => + async () => { - TResponse response = await next(); - await _unitOfWork.SaveChangesAsync(cancellationToken); - return response; - }), + TResponse? response = default; + await _unitOfWork.ExecuteInTransactionAsync(async () => + { + response = await next(); + }); + + return response!; + }, typeof(TRequest).Name); -} \ No newline at end of file +}