mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-15 18:47:43 -05:00
Splitting out default DacFx options for Publish and Schema Compare (#1126)
* Splitting out schema comp and publish defaults * Added test * Correcting comments, changing scope * Moving DeploymentOptions to DacFx folder due to dependency hierarchy between DacFx and SchemaCompare
This commit is contained in:
@@ -10,7 +10,6 @@ using Microsoft.SqlTools.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting;
|
||||
using Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
@@ -48,6 +47,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
serviceHost.SetRequestHandler(GenerateDeployPlanRequest.Type, this.HandleGenerateDeployPlanRequest);
|
||||
serviceHost.SetRequestHandler(GetOptionsFromProfileRequest.Type, this.HandleGetOptionsFromProfileRequest);
|
||||
serviceHost.SetRequestHandler(ValidateStreamingJobRequest.Type, this.HandleValidateStreamingJobRequest);
|
||||
serviceHost.SetRequestHandler(GetDefaultPublishOptionsRequest.Type, this.HandleGetDefaultPublishOptionsRequest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -239,7 +239,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
DacProfile profile = DacProfile.Load(parameters.ProfilePath);
|
||||
if (profile.DeployOptions != null)
|
||||
{
|
||||
options = new DeploymentOptions();
|
||||
options = DeploymentOptions.GetDefaultPublishOptions();
|
||||
await options.InitializeFromProfile(profile.DeployOptions, parameters.ProfilePath);
|
||||
}
|
||||
}
|
||||
@@ -276,6 +276,35 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles request to create default publish options for DacFx
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task HandleGetDefaultPublishOptionsRequest(GetDefaultPublishOptionsParams parameters, RequestContext<DacFxOptionsResult> requestContext)
|
||||
{
|
||||
try
|
||||
{
|
||||
// this does not need to be an async operation since this only creates and returns the default object
|
||||
DeploymentOptions options = DeploymentOptions.GetDefaultPublishOptions();
|
||||
|
||||
await requestContext.SendResult(new DacFxOptionsResult()
|
||||
{
|
||||
DeploymentOptions = options,
|
||||
Success = true,
|
||||
ErrorMessage = null
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
await requestContext.SendResult(new DacFxOptionsResult()
|
||||
{
|
||||
DeploymentOptions = null,
|
||||
Success = false,
|
||||
ErrorMessage = e.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteOperation(DacFxOperation operation, DacFxParams parameters, string taskName, RequestContext<DacFxResult> requestContext)
|
||||
{
|
||||
Task.Run(async () =>
|
||||
|
||||
Reference in New Issue
Block a user