GetDatabase() public static method

public static GetDatabase ( IDbExecutor dbExecutor, string databaseName ) : Db
dbExecutor IDbExecutor
databaseName string
return Db
        public override void ExecuteCommand()
        {
            using (var destinationConnection = new SqlConnection(Util.GetMasterConnectionString(DestinationConnectionString.ConnectionString)))
                using (var destinationDbExecutor = new SqlExecutor(destinationConnection))
                {
                    string sourceDbServerName      = Util.GetDatabaseServerName(SourceConnectionString);
                    string destinationDbServerName = Util.GetDatabaseServerName(DestinationConnectionString);

                    destinationConnection.Open();

                    var copyDbName = $"CopyOf{BackupName}";

                    var existingDatabaseBackup = Util.GetDatabase(
                        destinationDbExecutor,
                        copyDbName);

                    if (existingDatabaseBackup != null && existingDatabaseBackup.State == Util.OnlineState)
                    {
                        Log.Info("Skipping {0}. It already exists on {1} and is online.", copyDbName, destinationDbServerName);
                        return;
                    }

                    if (existingDatabaseBackup == null)
                    {
                        StartBackupCopy(
                            destinationDbExecutor,
                            sourceDbServerName,
                            destinationDbServerName,
                            BackupName,
                            copyDbName);

                        Log.Trace("Waiting 15 minutes for copy of {0} from {1} to {2} to complete.", BackupName, sourceDbServerName, destinationDbServerName);
                        if (!WhatIf)
                        {
                            Thread.Sleep(15 * 60 * 1000);
                        }
                    }

                    WaitForBackupCopy(
                        destinationDbExecutor,
                        destinationDbServerName,
                        copyDbName);
                }
        }