Beispiel #1
0
        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();
        }
Beispiel #2
0
 private static void StoringTenSwissGuysInTheDatabase(Database database)
 {
     for (int i = 0; i < 10; i++)
     {
         database.Store(new Customer {Name = "Daniel" + i});
     }
 }
Beispiel #3
0
        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();
            }
        }