Improvements to GenerateTSqlModel request and tests (#1611)

This commit is contained in:
Barbara Valdez
2022-08-01 13:50:13 -07:00
committed by GitHub
parent be37dba620
commit dc3deecbad
3 changed files with 105 additions and 109 deletions

View File

@@ -3,7 +3,6 @@
// 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.Utility;
namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
{
@@ -33,7 +32,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
/// </summary>
class GenerateTSqlModelRequest
{
public static readonly RequestType<GenerateTSqlModelParams, ResultStatus> Type =
RequestType<GenerateTSqlModelParams, ResultStatus>.Create("dacFx/generateTSqlModel");
public static readonly RequestType<GenerateTSqlModelParams, bool> Type =
RequestType<GenerateTSqlModelParams, bool>.Create("dacFx/generateTSqlModel");
}
}

View File

@@ -12,7 +12,6 @@ using Microsoft.SqlTools.ServiceLayer.DacFx.Contracts;
using Microsoft.SqlTools.ServiceLayer.Hosting;
using Microsoft.SqlTools.ServiceLayer.TaskServices;
using Microsoft.SqlServer.Dac.Model;
using Microsoft.SqlTools.ServiceLayer.Utility;
using DacTableDesigner = Microsoft.Data.Tools.Sql.DesignServices.TableDesigner.TableDesigner;
namespace Microsoft.SqlTools.ServiceLayer.DacFx
@@ -271,7 +270,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
});
}
public async Task HandleGenerateTSqlModelRequest(GenerateTSqlModelParams requestParams, RequestContext<ResultStatus> requestContext)
public async Task HandleGenerateTSqlModelRequest(GenerateTSqlModelParams requestParams, RequestContext<bool> requestContext)
{
try
{
@@ -279,11 +278,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
TSqlModel model = operation.GenerateTSqlModel();
projectModels.Value[operation.Parameters.ProjectUri] = model;
await requestContext.SendResult(new ResultStatus
{
Success = true,
ErrorMessage = null
});
await requestContext.SendResult(true);
}
catch (Exception e)
{