mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
handle dispose table designer request (#1273)
* handle dispose table designer * use connection string
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user