public void ExecuteDataSetInTransactionScope() { Action <int, int> loadMethod = (firstResult, maxResults) => { using (var cmd = SQLiteRepository.GetCommand(GetOrderDetailsSql)) using (var ds = SQLiteRepository.ExecuteDataSet(cmd, firstResult, maxResults)) { Assert.AreEqual(ds.Tables.Count, 1); Assert.IsFalse(ds.Tables[0].HasErrors); Assert.Greater(ds.Tables[0].Rows.Count, 0); //Console.WriteLine("RowCount: " + ds.Tables[0].Rows.Count); } }; AdoWith.TransactionScope(delegate { loadMethod(5, 10); loadMethod(5, 5); loadMethod(1, 1); }, delegate { loadMethod(5, 10); loadMethod(5, 5); loadMethod(1, 1); }, delegate { loadMethod(5, 10); loadMethod(5, 5); loadMethod(1, 1); }); }
public void ExecuteDataSetInTransactionScope() { Action <int, int> loadMethod = (firstResult, maxResults) => { using (var cmd = Repository.GetCommand(SQL_ORDER_SELECT)) using (var ds = Repository.ExecuteDataSet(cmd, firstResult, maxResults)) { ds.Tables.Count.Should().Be(1); var dataTable = ds.Tables[0]; VerifyDataTableHasData(dataTable); } }; AdoWith.TransactionScope(delegate { loadMethod(5, 10); loadMethod(5, 5); loadMethod(2, 2); }, delegate { loadMethod(5, 10); loadMethod(5, 5); loadMethod(1, 2); }, delegate { loadMethod(5, 10); loadMethod(5, 0); loadMethod(1, 0); }); }
public void ExecuteDataSetInTransactionScope() { Action <int, int> @loadMethod = (firstResult, maxResults) => { using (var ds = OdpRepository.ExecuteDataSet(SelectDemoCustomers, firstResult, maxResults)) { Assert.AreEqual(ds.Tables.Count, 1); Assert.IsFalse(ds.Tables[0].HasErrors); Assert.Greater(ds.Tables[0].Rows.Count, 0); } }; AdoWith.TransactionScope(delegate { @loadMethod(5, 10); @loadMethod(5, 5); @loadMethod(1, 1); }, delegate { @loadMethod(5, 10); @loadMethod(5, 5); @loadMethod(1, 1); }, delegate { @loadMethod(5, 10); @loadMethod(5, 5); @loadMethod(1, 1); }); }
public void UseTransactionScope() { AdoWith.TransactionScope(ExecuteDataSet, ExecuteDataSetWithParameter, ExecuteDataSetByProcedure); var query = NorthwindAdoRepository.QueryProvider.GetQuery("Order Details, GetAll"); AdoWith.TransactionScope( () => { using (NorthwindAdoRepository.ExecuteDataSetBySqlString(query)) {} }, () => { } ); }