mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
Fix/restore scripting issue (#521)
* fixed the bug with setting server execution mode before creating restore plan
This commit is contained in:
@@ -256,7 +256,12 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
|||||||
|
|
||||||
public override void Execute(TaskExecutionMode mode)
|
public override void Execute(TaskExecutionMode mode)
|
||||||
{
|
{
|
||||||
|
RestorePlanToExecute = null;
|
||||||
UpdateRestoreTaskObject();
|
UpdateRestoreTaskObject();
|
||||||
|
if (IsValid && RestorePlan.RestoreOperations != null && RestorePlan.RestoreOperations.Any())
|
||||||
|
{
|
||||||
|
GetRestorePlanForExecutionAndScript();
|
||||||
|
}
|
||||||
|
|
||||||
base.Execute(mode);
|
base.Execute(mode);
|
||||||
}
|
}
|
||||||
@@ -291,19 +296,17 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (IsValid && RestorePlan.RestoreOperations != null && RestorePlan.RestoreOperations.Any())
|
if (RestorePlanToExecute != null)
|
||||||
{
|
{
|
||||||
// Restore Plan should be already created and updated at this point
|
// Restore Plan should be already created and updated at this point
|
||||||
|
|
||||||
RestorePlan restorePlan = GetRestorePlanForExecutionAndScript();
|
if (RestorePlanToExecute != null && RestorePlanToExecute.RestoreOperations.Count > 0)
|
||||||
|
|
||||||
if (restorePlan != null && restorePlan.RestoreOperations.Count > 0)
|
|
||||||
{
|
{
|
||||||
restorePlan.PercentComplete += (object sender, PercentCompleteEventArgs e) =>
|
RestorePlanToExecute.PercentComplete += (object sender, PercentCompleteEventArgs e) =>
|
||||||
{
|
{
|
||||||
OnMessageAdded(new TaskMessage { Description = $"{e.Percent}%", Status = SqlTaskStatus.InProgress });
|
OnMessageAdded(new TaskMessage { Description = $"{e.Percent}%", Status = SqlTaskStatus.InProgress });
|
||||||
};
|
};
|
||||||
restorePlan.Execute();
|
RestorePlanToExecute.Execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user