Exemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="serverName"></param>
 /// <param name="destinationDatabaseName"></param>
 /// <param name="backup"></param>
 public DatabaseRestoreItem(Server server, string destinationDatabaseName, BackupHeader backup, DateTime?pointInTime, bool last)
 {
     if (string.IsNullOrWhiteSpace(destinationDatabaseName))
     {
         throw new ArgumentException(Properties.Resources.ArgumentIsNullOrWhitespace, nameof(destinationDatabaseName));
     }
     _server = server ?? throw new ArgumentNullException(nameof(server));
     _destinationDatabaseName = destinationDatabaseName;
     _backup      = backup ?? throw new ArgumentNullException(nameof(backup));
     _pointInTime = pointInTime;
     _last        = last;
 }
Exemplo n.º 2
0
        public IEnumerable <BackupHeader> GetLatestBackupSet(string serverName, string databaseName, bool includeDifferentials = true, bool includeLogs = false, DateTime?before = null)
        {
            BackupHeader latestBackup = GetLatestBackup(serverName, databaseName, includeDifferentials, includeLogs, before);

            return(latestBackup.BackupType switch
            {
                BackupType.Full => new List <BackupHeader> {
                    latestBackup
                },
                BackupType.Differential => new List <BackupHeader> {
                    GetFullForDiff(latestBackup), latestBackup
                },
                BackupType.Log => GetAllForLog(latestBackup),
                _ => Array.Empty <BackupHeader>()
            });