diff --git a/GitVersion.yml b/GitVersion.yml index 5cb6811..4889f22 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,4 +1,4 @@ -next-version: 1.0.0 +next-version: 1.0.1 mode: Mainline major-version-bump-message: '\+semver:\s?(breaking|major)' minor-version-bump-message: '\+semver:\s?(feature|minor)' diff --git a/src/LittleBlocks.Ef.UnitOfWork/UnitOfWork.cs b/src/LittleBlocks.Ef.UnitOfWork/UnitOfWork.cs index 62a0aff..e1013e1 100644 --- a/src/LittleBlocks.Ef.UnitOfWork/UnitOfWork.cs +++ b/src/LittleBlocks.Ef.UnitOfWork/UnitOfWork.cs @@ -74,18 +74,16 @@ public async Task SaveChangesAsync(bool ensureAutoHistory = false) public async Task SaveChangesAsync(bool ensureAutoHistory = false, params IUnitOfWork[] unitOfWorks) { - using (var ts = new TransactionScope()) - { - var tasks = unitOfWorks.Select(async unitOfWork => await unitOfWork.SaveChangesAsync(ensureAutoHistory)).ToList(); - var results = await Task.WhenAll(tasks); + using var ts = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled); + var tasks = unitOfWorks.Select(async unitOfWork => await unitOfWork.SaveChangesAsync(ensureAutoHistory)).ToList(); + var results = await Task.WhenAll(tasks); - var count = results.Sum(); - count += await SaveChangesAsync(ensureAutoHistory); + var count = results.Sum(); + count += await SaveChangesAsync(ensureAutoHistory); - ts.Complete(); + ts.Complete(); - return count; - } + return count; } public void Dispose()