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