public async Task SetManualSuspicionLevelsAsync(ManualSuspicionLevels manualSuspicionLevels) { using (var ts = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(30), TransactionScopeAsyncFlowOption.Enabled)) { db.AddOrUpdate(manualSuspicionLevels, p => p.TaskId == manualSuspicionLevels.TaskId); await db.SaveChangesAsync().ConfigureAwait(false); ts.Complete(); } }
public async Task SetManualSuspicionLevelsAsync(ManualSuspicionLevels manualSuspicionLevels) { var executionStrategy = new NpgsqlRetryingExecutionStrategy(db, 3); await executionStrategy.ExecuteAsync(async() => { using (var ts = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(30), TransactionScopeAsyncFlowOption.Enabled)) { db.AddOrUpdate(manualSuspicionLevels, p => p.TaskId == manualSuspicionLevels.TaskId && p.Language == manualSuspicionLevels.Language); await db.SaveChangesAsync().ConfigureAwait(false); ts.Complete(); } }); }