Beispiel #1
0
 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);
         }
     }
 }
Beispiel #2
0
        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");
            }
        }
Beispiel #3
0
        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));
            }
        }
Beispiel #4
0
        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));
            }
        }