Для транзакции блок try-catch больше не нужен

This commit is contained in:
Оля Бизюкова 2024-12-09 14:45:33 +05:00
parent 4ccbe4361a
commit 42fe4dee50

View File

@ -101,8 +101,7 @@ public class ChangeLogRepository : IChangeLogRepository
var result = 0; var result = 0;
using var transaction = await db.Database.BeginTransactionAsync(token); using var transaction = await db.Database.BeginTransactionAsync(token);
try
{
foreach (var dto in dtos) foreach (var dto in dtos)
{ {
var updatedEntity = updatedEntities.GetValueOrDefault(dto.Id); var updatedEntity = updatedEntities.GetValueOrDefault(dto.Id);
@ -123,12 +122,8 @@ public class ChangeLogRepository : IChangeLogRepository
await transaction.CommitAsync(token); await transaction.CommitAsync(token);
return result; return result;
}
catch
{
await transaction.RollbackAsync(token);
throw;
}
} }
public async Task<PaginationContainer<DataWithWellDepthAndSectionDto>> GetByDate( public async Task<PaginationContainer<DataWithWellDepthAndSectionDto>> GetByDate(