handle dispose table designer request (#1273)

* handle dispose table designer

* use connection string
This commit is contained in:
Alan Ren
2021-10-19 13:04:01 -07:00
committed by GitHub
parent 192f7fccd4
commit 1a52a9ee84
3 changed files with 48 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
//
// 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;
namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts
{
public class DisposeTableDesignerResponse
{
}
/// <summary>
/// The request to dispose the table designer.
/// </summary>
public class DisposeTableDesignerRequest
{
/// <summary>
/// Request definition
/// </summary>
public static readonly RequestType<TableInfo, DisposeTableDesignerResponse> Type = RequestType<TableInfo, DisposeTableDesignerResponse>.Create("tabledesigner/dispose");
}
}

View File

@@ -20,6 +20,8 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts
public bool IsNewTable { get; set; }
public string ConnectionUri { get; set; }
public string ConnectionString { get; set; }
public string Id { get; set; }
}
}

View File

@@ -50,6 +50,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
this.ServiceHost.SetRequestHandler(GetTableDesignerInfoRequest.Type, HandleGetTableDesignerInfoRequest);
this.ServiceHost.SetRequestHandler(ProcessTableDesignerEditRequest.Type, HandleProcessTableDesignerEditRequest);
this.ServiceHost.SetRequestHandler(SaveTableChangesRequest.Type, HandleSaveTableChangesRequest);
this.ServiceHost.SetRequestHandler(DisposeTableDesignerRequest.Type, HandleDisposeTableDesignerRequest);
}
private async Task HandleGetTableDesignerInfoRequest(TableInfo tableInfo, RequestContext<TableDesignerInfo> requestContext)
@@ -123,6 +124,23 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
});
}
private async Task HandleDisposeTableDesignerRequest(TableInfo tableInfo, RequestContext<DisposeTableDesignerResponse> requestContext)
{
await Task.Run(async () =>
{
try
{
// TODO: Handle the dispose table designer request.
await requestContext.SendResult(new DisposeTableDesignerResponse());
}
catch (Exception e)
{
await requestContext.SendError(e);
}
});
}
private void HandleAddItemRequest(ProcessTableDesignerEditRequestParams requestParams)
{
var property = requestParams.TableChangeInfo.Property;
@@ -138,7 +156,9 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner
default:
break;
}
} else {
}
else
{
// TODO: Handle the add item request on second level properties, e.g. Adding a column to an index
}
}