예제 #1
0
		private int Run(
			DatabaseLogger logger,
			IEnumerable<DbMaintenanceSettings> databasesToBackup,
			Action<string, string> maintenanceOperation)
		{
			var databaseBackupedCount = 0;

			foreach (var database in databasesToBackup)
			{
				try
				{
					maintenanceOperation(database.Name, database.Path);

					logger.Successed(database.Name);

					databaseBackupedCount++;
				}
				catch (Exception exception)
				{
					logger.Failed(database.Name, exception);
				}
			}

			return databaseBackupedCount;
		}
예제 #2
0
        public int Restore(
            DatabaseLogger logger,
            string connectionString,
            IEnumerable <DbMaintenanceSettings> databasesToRestore)
        {
            var sqlDatabase = new SqlDatabase(connectionString);

            Action <string, string> action = sqlDatabase.Restore;

            return(Run(logger, databasesToRestore, action));
        }
예제 #3
0
		public int Restore(
			DatabaseLogger logger,
			string connectionString,
			IEnumerable<DbMaintenanceSettings> databasesToRestore)
		{
			var sqlDatabase = new SqlDatabase(connectionString);

			Action<string, string> action = sqlDatabase.Restore;

			return Run(logger, databasesToRestore, action);
		}
예제 #4
0
        public int Restore(
            DatabaseLogger logger,
            string connectionString,
            IEnumerable <DbMaintenanceSettings> databasesToRestore,
            string restorePath)
        {
            var sqlDatabase = new SqlDatabase(connectionString);

            Action <string, string> action =
                (databaseName, backupPath) => sqlDatabase.Restore(databaseName, backupPath, restorePath);

            return(Run(logger, databasesToRestore, action));
        }
예제 #5
0
		public int Restore(
			DatabaseLogger logger,
			string connectionString,
			IEnumerable<DbMaintenanceSettings> databasesToRestore,
			string restorePath)
		{
			var sqlDatabase = new SqlDatabase(connectionString);

			Action<string, string> action =
				(databaseName, backupPath) => sqlDatabase.Restore(databaseName, backupPath, restorePath);

			return Run(logger, databasesToRestore, action);
		}
예제 #6
0
        public int Backup(
            DatabaseLogger logger,
            string connectionString,
            IEnumerable <DbMaintenanceSettings> databasesToBackup,
            bool appendDatabaseBackup)
        {
            var sqlDatabase = new SqlDatabase(connectionString);

            Action <string, string> action =
                (databaseName, databasePath) =>
                sqlDatabase.Backup(databaseName, databasePath, appendDatabaseBackup);

            return(Run(logger, databasesToBackup, action));
        }
예제 #7
0
		public int Backup(
			DatabaseLogger logger,
			string connectionString,
			IEnumerable<DbMaintenanceSettings> databasesToBackup,
			bool appendDatabaseBackup)
		{
			var sqlDatabase = new SqlDatabase(connectionString);

			Action<string, string> action =
				(databaseName, databasePath) =>
					sqlDatabase.Backup(databaseName, databasePath, appendDatabaseBackup);

			return Run(logger, databasesToBackup, action);
		}