Open dacfx deploy script instead of saving to file path (#822)

* open dacfx deploy script

* moving test db cleanups into finally blocks
This commit is contained in:
Kim Santiago
2019-06-10 09:26:42 -07:00
committed by GitHub
parent 43abb8def2
commit f7c86a80ca
8 changed files with 244 additions and 211 deletions

View File

@@ -49,12 +49,6 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
}
public void Execute(TaskExecutionMode mode)
{
Execute();
AddScriptToTask();
}
public void Execute()
{
if (this.CancellationToken.IsCancellationRequested)
{
@@ -64,6 +58,17 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
try
{
this.ScriptGenerationResult = this.ComparisonResult.GenerateScript(this.Parameters.TargetDatabaseName);
// tests don't create a SqlTask, so only add the script when the SqlTask isn't null
if (this.SqlTask != null)
{
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, this.ScriptGenerationResult.Script);
if (!string.IsNullOrEmpty(this.ScriptGenerationResult.MasterScript))
{
// master script is only used if the target is Azure SQL db and the script contains all operations that must be done against the master database
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, ScriptGenerationResult.MasterScript);
}
}
}
catch (Exception e)
{
@@ -73,17 +78,6 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
}
}
// Separated from Execute() since tests don't create SqlTasks
public void AddScriptToTask()
{
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, this.ScriptGenerationResult.Script);
if (!string.IsNullOrEmpty(this.ScriptGenerationResult.MasterScript))
{
// master script is only used if the target is Azure SQL db and the script contains all operations that must be done against the master database
this.SqlTask.AddScript(SqlTaskStatus.Succeeded, ScriptGenerationResult.MasterScript);
}
}
// The schema compare public api doesn't currently take a cancellation token so the operation can't be cancelled
public void Cancel()
{