mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-19 09:35:36 -05:00
remove SchemaComparePublishChangesRequest (#1446)
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for a schema compare publish changes request.
|
||||
/// </summary>
|
||||
public class SchemaComparePublishChangesParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Operation id of the schema compare operation
|
||||
/// </summary>
|
||||
public string OperationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of target server
|
||||
/// </summary>
|
||||
public string TargetServerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of target database
|
||||
/// </summary>
|
||||
public string TargetDatabaseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Execution mode for the operation. Default is execution
|
||||
/// </summary>
|
||||
public TaskExecutionMode TaskExecutionMode { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the Schema Compare publish changes request type
|
||||
/// </summary>
|
||||
class SchemaComparePublishChangesRequest
|
||||
{
|
||||
public static readonly RequestType<SchemaComparePublishDatabaseChangesParams, ResultStatus> Type =
|
||||
RequestType<SchemaComparePublishDatabaseChangesParams, ResultStatus>.Create("schemaCompare/publish");
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,6 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
|
||||
serviceHost.SetRequestHandler(SchemaCompareRequest.Type, this.HandleSchemaCompareRequest);
|
||||
serviceHost.SetRequestHandler(SchemaCompareCancellationRequest.Type, this.HandleSchemaCompareCancelRequest);
|
||||
serviceHost.SetRequestHandler(SchemaCompareGenerateScriptRequest.Type, this.HandleSchemaCompareGenerateScriptRequest);
|
||||
serviceHost.SetRequestHandler(SchemaComparePublishChangesRequest.Type, this.HandleSchemaComparePublishChangesRequest);
|
||||
serviceHost.SetRequestHandler(SchemaComparePublishDatabaseChangesRequest.Type, this.HandleSchemaComparePublishDatabaseChangesRequest);
|
||||
serviceHost.SetRequestHandler(SchemaComparePublishProjectChangesRequest.Type, this.HandleSchemaComparePublishProjectChangesRequest);
|
||||
serviceHost.SetRequestHandler(SchemaCompareIncludeExcludeNodeRequest.Type, this.HandleSchemaCompareIncludeExcludeNodeRequest);
|
||||
@@ -196,40 +195,6 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles request for schema compare publish changes script
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task HandleSchemaComparePublishChangesRequest(SchemaComparePublishDatabaseChangesParams parameters, RequestContext<ResultStatus> requestContext)
|
||||
{
|
||||
SchemaComparePublishDatabaseChangesOperation operation = null;
|
||||
try
|
||||
{
|
||||
SchemaComparisonResult compareResult = schemaCompareResults.Value[parameters.OperationId];
|
||||
operation = new SchemaComparePublishDatabaseChangesOperation(parameters, compareResult);
|
||||
TaskMetadata metadata = new TaskMetadata();
|
||||
metadata.TaskOperation = operation;
|
||||
metadata.ServerName = parameters.TargetServerName;
|
||||
metadata.DatabaseName = parameters.TargetDatabaseName;
|
||||
metadata.Name = SR.PublishChangesTaskName;
|
||||
SqlTask sqlTask = SqlTaskManagerInstance.CreateAndRun<SqlTask>(metadata);
|
||||
await requestContext.SendResult(new ResultStatus()
|
||||
{
|
||||
Success = true,
|
||||
ErrorMessage = operation.ErrorMessage
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Write(TraceEventType.Error, "Failed to publish schema compare changes. Error: " + e);
|
||||
await requestContext.SendResult(new ResultStatus()
|
||||
{
|
||||
Success = false,
|
||||
ErrorMessage = operation == null ? e.Message : operation.ErrorMessage,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles request for schema compare publish database changes script
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user