public void TestSqlTransactionForBatchQuery() { using (var connection = new MySqlConnection(Database.ConnectionString)) { // Prepare using (var transaction = connection.EnsureOpen().BeginTransaction()) { // Act connection.BatchQuery <CompleteTable>(0, 10, OrderField.Parse(new { Id = Order.Ascending }), it => it.Id != 0, transaction: transaction); } } }
public void ThrowExceptionOnMySqlConnectionBatchQueryWithHints() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act connection.BatchQuery <CompleteTable>(0, 3, OrderField.Ascending <CompleteTable>(c => c.Id).AsEnumerable(), (object)null, hints: "WhatEver"); } }
public void TestMySqlConnectionBatchQueryThirdBatchDescending() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act var result = connection.BatchQuery <CompleteTable>(2, 3, OrderField.Descending <CompleteTable>(c => c.Id).AsEnumerable(), (object)null); // Assert Helper.AssertPropertiesEquality(tables.ElementAt(3), result.ElementAt(0)); Helper.AssertPropertiesEquality(tables.ElementAt(1), result.ElementAt(2)); } }
public void TestMySqlConnectionBatchQueryViaTableNameThirdBatchAscending() { // Setup var tables = Database.CreateCompleteTables(10); using (var connection = new MySqlConnection(Database.ConnectionString)) { // Act var result = connection.BatchQuery(ClassMappedNameCache.Get <CompleteTable>(), 2, 3, OrderField.Ascending <CompleteTable>(c => c.Id).AsEnumerable(), (object)null); // Assert Helper.AssertMembersEquality(tables.ElementAt(6), result.ElementAt(0)); Helper.AssertMembersEquality(tables.ElementAt(8), result.ElementAt(2)); } }