Example #1
0
 private void executeButton_Click(object sender, EventArgs e)
 {
     try {
         SyncDatabaseParmsBase sourceParms = SyncDatabaseParmsFactory.CreateParms(
             sourceScriptsFolderTextBox.Text,
             sourceServerNameTextBox.Text, sourceDatabaseNameTextBox.Text,
             sourceDbUserNameTextBox.Text,
             sourcePasswordTextBox.Text);
         SyncDatabaseParmsBase destinationParms = SyncDatabaseParmsFactory.CreateParms(null,
                                                                                       destinationServerNameTextBox
                                                                                           .Text,
                                                                                       destinationDbNameTextBox.
                                                                                           Text,
                                                                                       destinationDbUserNameTextBox
                                                                                           .Text,
                                                                                       destinationPasswordTextBox
                                                                                           .Text);
         var sync = new SchemaSyncEngine(sourceParms, destinationParms);
         sync.Execute();
         MessageBox.Show("Completed!");
     }
     catch (Exception err) {
         MessageBox.Show(string.Format("Error occured {0}", err));
     }
 }
 private void SyncDB()
 {
     Log(Level.Info, "Processing Parameters");
     Log(Level.Info, "Source Parameters");
     Log(Level.Info, "\tServer Name: {0}", SourceServerName ?? "NULL");
     Log(Level.Info, "\tDB Name: {0}", SourceDbName ?? "NULL");
     Log(Level.Info, "\tDB User Name: {0}", SourceDbUserName ?? "NULL");
     Log(Level.Info, "\tDB Password: {0}", SourceDbPassword ?? "NULL");
     Log(Level.Info, "\tScripts Path: {0}", SourceScriptsPath ?? "NULL");
     Log(Level.Info, "");
     Log(Level.Info, "Destination Parameters");
     Log(Level.Info, "\tServer Name: {0}", DestinationServerName ?? "NULL");
     Log(Level.Info, "\tDB Name: {0}", DestinationDbName ?? "NULL");
     Log(Level.Info, "\tDB User Name: {0}", DestinationDbUserName ?? "NULL");
     Log(Level.Info, "\tDB Password: {0}", DestinationDbPassword ?? "NULL");
     try {
         SyncDatabaseParmsBase sourceParms = SyncDatabaseParmsFactory.CreateParms(SourceScriptsPath,
                                                                                  SourceServerName, SourceDbName,
                                                                                  SourceDbUserName,
                                                                                  SourceDbPassword);
         SyncDatabaseParmsBase destinationParms = SyncDatabaseParmsFactory.CreateParms(null,
                                                                                       DestinationServerName,
                                                                                       DestinationDbName,
                                                                                       DestinationDbUserName,
                                                                                       DestinationDbPassword);
         var sync = new SchemaSyncEngine(sourceParms, destinationParms);
         sync.Execute();
         Log(Level.Info, "Sync complete");
     }
     catch (Exception e) {
         throw new BuildException(e.Message);
     }
 }