Esempio n. 1
0
        public async Task StoreAsyncSupportsAmbientTransactionRollback(DatabaseMode mode)
        {
            var slide = new Slide(title: "Store Async supports ambient transactions - rollback");
            await slide
                .Sample(async () =>
                {
                    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();
                });
        }
Esempio n. 2
0
        public async Task StoreAsync(DatabaseMode mode)
        {
            var slide = new Slide(title: "Store Async");
            await slide
                .BulletPoint("OMG! You just rolled your own NoSQL database, right?")

                .Sample(async () =>
                {
                    var database = new Database("StoreAsync.received.txt", mode);
                    StoringTenSwissGuysInTheDatabase(database);

                    try
                    {
                        await database.SaveAsync().ConfigureAwait(false);
                    }
                    finally
                    {
                        database.Close();
                    }
                });
        }