public bool SetJobConfiguration(RecoveryJobType jobType, RecoveryPersistenceConfiguration config, string db, int jobCount = 0) { bool status = false; if (_activeContext == null) { try { PersistenceContext _context = new PersistenceContext(); _context.JobType = jobType; _context.SharedQueue = this._persistenceQueue; _context.PersistenceConfiguration = config; _context.ActiveDB = db; foreach (string fileName in config.FileName) { switch (jobType) { case RecoveryJobType.ConfigBackup: case RecoveryJobType.DataBackup: case RecoveryJobType.FullBackup: BackupFile file = new BackupFile(fileName, config.FilePath, config.UserName, config.Password); file.FileHeader.Database = config.DatabaseName; file.FileHeader.DatabaseCluster = config.Cluster; _context.AddNewFile(file); break; case RecoveryJobType.ConfigRestore: case RecoveryJobType.DataRestore: _context.AddNewFile(new BackupFile(fileName, config.FilePath, config.UserName, config.Password)); break; } } _activeContext = _context; CreatePersistenceRoles(_context, jobCount == 0 ? DEFAULT_JOB_COUNT : jobCount); status = true; } catch (Exception exp) { if (LoggerManager.Instance.RecoveryLogger != null && LoggerManager.Instance.RecoveryLogger.IsErrorEnabled) { LoggerManager.Instance.RecoveryLogger.Error("RecoveryPersistenceManager.SetConfig()", exp.ToString()); } } } return(status); }