public async Task StoreAsyncSupportsAmbientTransactionRollback(DatabaseMode mode) { var database = new Database("StoreAsyncSupportsAmbientTransactionRollback.received.txt", mode); StoringTenSwissGuysInTheDatabase(database); using (var tx = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { await database.SaveAsync().ConfigureAwait(false); // Rollback } database.Close(); }
private static void StoringTenSwissGuysInTheDatabase(Database database) { for (int i = 0; i < 10; i++) { database.Store(new Customer {Name = "Daniel" + i}); } }
public async Task StoreAsync(DatabaseMode mode) { var database = new Database("StoreAsync.received.txt", mode); StoringTenSwissGuysInTheDatabase(database); try { await database.SaveAsync().ConfigureAwait(false); } finally { database.Close(); } }