public void Open(string connectionStringPrimary, string connectionStringSecondary)
 {
     Close();
     Connection = new DbConnectionRedundant(connectionStringPrimary, connectionStringSecondary);
     Connection.StateRedundantChange += Connection_StateRedundantChange;
     Connection.Open();
 }
 public DbCommandRedundant(string commandText, DbConnectionRedundant connection)
 {
     _dbConnection    = connection;
     _commandText     = commandText.Trim();
     _statementType   = _determineStatementType(commandText);
     CommandPrimary   = new MySqlCommand(commandText, connection.ConnectionPrimary);
     CommandSecondary = new MySqlCommand(commandText, connection.ConnectionSecondary);
 }
 public override void Open(ConnectionStringSettingsCollection connectionStringSettingsCollection)
 {
     ConnectionStringPrimary   = connectionStringSettingsCollection[ConnectionStringsNames.Primary]?.ConnectionString;
     ConnectionStringSecondary = connectionStringSettingsCollection[ConnectionStringsNames.Secondary]?.ConnectionString;
     Close();
     Connection = new DbConnectionRedundant(ConnectionStringPrimary, ConnectionStringSecondary);
     Connection.StateRedundantChange += Connection_StateRedundantChange;
     Connection.Open();
 }
 internal DbCommandRedundant(DbConnectionRedundant connection)
 {
     _dbConnection  = connection;
     CommandPrimary = new MySqlCommand {
         Connection = connection.ConnectionPrimary
     };
     CommandSecondary = new MySqlCommand {
         Connection = connection.ConnectionSecondary
     };
 }
Пример #5
0
 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;
 }
 public void CloneDatabase(string connectionStringSource, string connectionStringDestination)
 {
     DbConnectionRedundant.CloneDatabase(connectionStringSource, connectionStringDestination);
     DbConnectionRedundant.TestConnect(connectionStringDestination);
 }
 public void DropDatabase(string connectionString)
 {
     DbConnectionRedundant.DropDatabase(connectionString);
 }
 public bool CreateEmptyDatabase(string connectionString, string collate)
 {
     return(DbConnectionRedundant.CreateEmptyDatabase(connectionString, collate));
 }
 public void TestConnect(string connectionString)
 {
     DbConnectionRedundant.TestConnect(connectionString);
 }
Пример #10
0
 public UpdateManager(DbConnectionRedundant connection)
 {
     _connection = connection;
 }