mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Addressing PR 14 feedback
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
<!-- Add the SSMS repo for private requirements -->
|
<!-- Add the SSMS repo for private requirements -->
|
||||||
<add key="SQLDS - SSMS" value="http://SQLISNuget/DS-SSMS/nuget/" />
|
<add key="SQLDS - SSMS" value="http://SQLISNuget/DS-SSMS/nuget/" />
|
||||||
<add key="CrossPlat" value="W:/" />
|
|
||||||
</packageSources>
|
</packageSources>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -38,17 +38,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
|||||||
|
|
||||||
public ConnectionDetails ConnectionDetails { get; private set; }
|
public ConnectionDetails ConnectionDetails { get; private set; }
|
||||||
|
|
||||||
public DbConnection SqlConnection { get; private set; }
|
public DbConnection SqlConnection { get; set; }
|
||||||
|
|
||||||
public void OpenConnection()
|
|
||||||
{
|
|
||||||
// build the connection string from the input parameters
|
|
||||||
string connectionString = ConnectionService.BuildConnectionString(ConnectionDetails);
|
|
||||||
|
|
||||||
// create a sql connection instance
|
|
||||||
SqlConnection = Factory.CreateSqlConnection(connectionString);
|
|
||||||
SqlConnection.Open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -170,7 +160,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
|||||||
var response = new ConnectResponse();
|
var response = new ConnectResponse();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connectionInfo.OpenConnection();
|
// build the connection string from the input parameters
|
||||||
|
string connectionString = ConnectionService.BuildConnectionString(connectionInfo.ConnectionDetails);
|
||||||
|
|
||||||
|
// create a sql connection instance
|
||||||
|
connectionInfo.SqlConnection = connectionInfo.Factory.CreateSqlConnection(connectionString);
|
||||||
|
connectionInfo.SqlConnection.Open();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,31 +27,19 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parameters for the Disconnect Request.
|
/// Message format for the connection result response
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DisconnectParams
|
public class ConnectResponse
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A URI identifying the owner of the connection. This will most commonly be a file in the workspace
|
/// A GUID representing a unique connection ID
|
||||||
/// or a virtual file representing an object in a database.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OwnerUri { get; set; }
|
public string ConnectionId { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Parameters for the ConnectionChanged Notification.
|
|
||||||
/// </summary>
|
|
||||||
public class ConnectionChangedParams
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A URI identifying the owner of the connection. This will most commonly be a file in the workspace
|
/// Gets or sets any connection error messages
|
||||||
/// or a virtual file representing an object in a database.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OwnerUri { get; set; }
|
public string Messages { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// Contains the high-level properties about the connection, for display to the user.
|
|
||||||
/// </summary>
|
|
||||||
public ConnectionSummary Connection { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -74,6 +62,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Message format for the initial connection request
|
/// Message format for the initial connection request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -88,22 +77,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
|||||||
// TODO Handle full set of properties
|
// TODO Handle full set of properties
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Message format for the connection result response
|
|
||||||
/// </summary>
|
|
||||||
public class ConnectResponse
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A GUID representing a unique connection ID
|
|
||||||
/// </summary>
|
|
||||||
public string ConnectionId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets any connection error messages
|
|
||||||
/// </summary>
|
|
||||||
public string Messages { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect request mapping entry
|
/// Connect request mapping entry
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -113,25 +86,4 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
|||||||
RequestType<ConnectParams, ConnectResponse> Type =
|
RequestType<ConnectParams, ConnectResponse> Type =
|
||||||
RequestType<ConnectParams, ConnectResponse>.Create("connection/connect");
|
RequestType<ConnectParams, ConnectResponse>.Create("connection/connect");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disconnect request mapping entry
|
|
||||||
/// </summary>
|
|
||||||
public class DisconnectRequest
|
|
||||||
{
|
|
||||||
public static readonly
|
|
||||||
RequestType<DisconnectParams, bool> Type =
|
|
||||||
RequestType<DisconnectParams, bool>.Create("connection/disconnect");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ConnectionChanged notification mapping entry
|
|
||||||
/// </summary>
|
|
||||||
public class ConnectionChangedNotification
|
|
||||||
{
|
|
||||||
public static readonly
|
|
||||||
EventType<ConnectionChangedParams> Type =
|
|
||||||
EventType<ConnectionChangedParams>.Create("connection/connectionchanged");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// 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.ServiceLayer.Hosting.Protocol.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Parameters for the ConnectionChanged Notification.
|
||||||
|
/// </summary>
|
||||||
|
public class ConnectionChangedParams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A URI identifying the owner of the connection. This will most commonly be a file in the workspace
|
||||||
|
/// or a virtual file representing an object in a database.
|
||||||
|
/// </summary>
|
||||||
|
public string OwnerUri { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the high-level properties about the connection, for display to the user.
|
||||||
|
/// </summary>
|
||||||
|
public ConnectionSummary Connection { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ConnectionChanged notification mapping entry
|
||||||
|
/// </summary>
|
||||||
|
public class ConnectionChangedNotification
|
||||||
|
{
|
||||||
|
public static readonly
|
||||||
|
EventType<ConnectionChangedParams> Type =
|
||||||
|
EventType<ConnectionChangedParams>.Create("connection/connectionchanged");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// 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.ServiceLayer.Hosting.Protocol.Contracts;
|
||||||
|
|
||||||
|
namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Parameters for the Disconnect Request.
|
||||||
|
/// </summary>
|
||||||
|
public class DisconnectParams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A URI identifying the owner of the connection. This will most commonly be a file in the workspace
|
||||||
|
/// or a virtual file representing an object in a database.
|
||||||
|
/// </summary>
|
||||||
|
public string OwnerUri { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect request mapping entry
|
||||||
|
/// </summary>
|
||||||
|
public class DisconnectRequest
|
||||||
|
{
|
||||||
|
public static readonly
|
||||||
|
RequestType<DisconnectParams, bool> Type =
|
||||||
|
RequestType<DisconnectParams, bool>.Create("connection/disconnect");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user