From 0d1aa4f6becf469eec61ffcd569ec3a2799ceb6f Mon Sep 17 00:00:00 2001 From: Anatolii Grynchuk Date: Tue, 12 May 2026 21:37:38 +0300 Subject: [PATCH] chore: update package versions and refactor TransactionBehavior - Upgrade EF Core packages to 10.0.x and HrynCo.DAL.Abstract to 1.0.10 - Refactor TransactionBehavior to simplify transaction handling logic --- Directory.Packages.props | 12 ++++++------ .../Behaviors/TransactionBehavior.cs | 16 ++++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) 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 +}