fixed the bugs with creating new restore plan (#433)

* fixed the bug with source db name not setting correctly when new plan created
This commit is contained in:
Leila Lali
2017-08-16 08:54:05 -07:00
committed by GitHub
parent d6c6700a3a
commit f95a652174
6 changed files with 390 additions and 89 deletions

View File

@@ -15,7 +15,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery
{
public class RestoreOptionsHelper
{
//The list of name that service sends to client as options
//The list of names service uses to sends restore options to client
private static string[] optionNames = new string[] { KeepReplication, ReplaceDatabase , SetRestrictedUser, RecoveryState ,
BackupTailLog , TailLogBackupFile, TailLogWithNoRecovery, CloseExistingConnections, RelocateDbFiles, DataFileFolder, LogFileFolder,
StandbyFile,
@@ -241,6 +241,8 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery
Dictionary<string, RestorePlanDetailInfo> options = new Dictionary<string, RestorePlanDetailInfo>();
RestoreOptionFactory restoreOptionFactory = RestoreOptionFactory.Instance;
//Create the options using the current values
foreach (var optionKey in optionNames)
{
var optionInfo = restoreOptionFactory.CreateOptionInfo(optionKey, restoreDataObject);
@@ -248,6 +250,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery
}
// After all options are set verify them all again to set the read only
// Because some options can change the readonly mode of other options.( e.g Recovery state can affect StandBy to be readyonly)
foreach (var optionKey in optionNames)
{
restoreOptionFactory.UpdateOption(optionKey, restoreDataObject, options[optionKey]);
@@ -292,7 +295,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery
string error = restoreOptionFactory.ValidateOption(optionKey, restoreDataObject);
if (!string.IsNullOrEmpty(error))
{
//TODO: we could send back the error message so client knows the option is set incorrectly
//TODO: we could send back the error message so client knows the option is set incorrectly
}
}