Пример #1
0
 public DbCommandRedundant(string commandText, DbConnectionRedundant connection)
 {
     _dbConnection     = connection;
     CommandText       = commandText;
     _commandPrimary   = new MySqlCommand(commandText, connection.ConnectionPrimary);
     _commandSecondary = new MySqlCommand(commandText, connection.ConnectionSecondary);
 }
Пример #2
0
 internal DbCommandRedundant(DbConnectionRedundant connection)
 {
     _dbConnection   = connection;
     _commandPrimary = new MySqlCommand()
     {
         Connection = connection.ConnectionPrimary
     };
     _commandSecondary = new MySqlCommand()
     {
         Connection = connection.ConnectionSecondary
     };
 }
 internal DbTransactionRedundant(DbConnectionRedundant connection)
 {
     if (connection.ActiveTransaction != null)
     {
         throw new InvalidOperationException("Nested transactions are not supported");
     }
     connection.ActiveTransaction = this;
     try
     {
         _transactionPrimary   = connection.ConnectionPrimary?.State == ConnectionState.Open ? connection.ConnectionPrimary.BeginTransaction() : null;
         _transactionSecondary = connection.ConnectionSecondary?.State == ConnectionState.Open ? connection.ConnectionSecondary.BeginTransaction() : null;
     }
     catch { }
     _connection = connection;
 }