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
This commit is contained in:
Anatolii Grynchuk
2026-05-12 21:37:38 +03:00
parent 637af06a9c
commit 0d1aa4f6be
2 changed files with 16 additions and 12 deletions
@@ -18,11 +18,15 @@ public class TransactionBehavior<TRequest, TResponse> : IPipelineBehavior<TReque
public Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> 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);
}
}