mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-20 09:35:38 -05:00
Move unused forked code to external directory (#1192)
* Move unused forked code to external directory * Fix SLN build errors * Add back resource provider core since it's referenced by main resource provider project * Update PackageProjects step of pipeline
This commit is contained in:
24
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/CancelConnectParams.cs
vendored
Normal file
24
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/CancelConnectParams.cs
vendored
Normal 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.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for the Cancel Connect Request.
|
||||
/// </summary>
|
||||
public class CancelConnectParams
|
||||
{
|
||||
/// <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>
|
||||
/// The type of connection we are trying to cancel
|
||||
/// </summary>
|
||||
public string Type { get; set; } = ConnectionType.Default;
|
||||
}
|
||||
}
|
||||
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/CancelConnectRequest.cs
vendored
Normal file
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/CancelConnectRequest.cs
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Cancel connect request mapping entry
|
||||
/// </summary>
|
||||
public class CancelConnectRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<CancelConnectParams, bool> Type =
|
||||
RequestType<CancelConnectParams, bool>.Create("connection/cancelconnect");
|
||||
}
|
||||
}
|
||||
23
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ChangeDatabaseParams.cs
vendored
Normal file
23
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ChangeDatabaseParams.cs
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for the List Databases Request.
|
||||
/// </summary>
|
||||
public class ChangeDatabaseParams
|
||||
{
|
||||
/// <summary>
|
||||
/// URI of the owner of the connection requesting the list of databases.
|
||||
/// </summary>
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The database to change to
|
||||
/// </summary>
|
||||
public string NewDatabase { get; set; }
|
||||
}
|
||||
}
|
||||
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ChangeDatabaseRequest.cs
vendored
Normal file
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ChangeDatabaseRequest.cs
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// List databases request mapping entry
|
||||
/// </summary>
|
||||
public class ChangeDatabaseRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<ChangeDatabaseParams, bool> Type =
|
||||
RequestType<ChangeDatabaseParams, bool>.Create("connection/changedatabase");
|
||||
}
|
||||
}
|
||||
37
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectParams.cs
vendored
Normal file
37
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectParams.cs
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for the Connect Request.
|
||||
/// </summary>
|
||||
public class ConnectParams
|
||||
{
|
||||
/// <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 required parameters to initialize a connection to a database.
|
||||
/// A connection will identified by its server name, database name and user name.
|
||||
/// This may be changed in the future to support multiple connections with different
|
||||
/// connection properties to the same database.
|
||||
/// </summary>
|
||||
public ConnectionDetails Connection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of this connection. By default, this is set to ConnectionType.Default.
|
||||
/// </summary>
|
||||
public string Type { get; set; } = ConnectionType.Default;
|
||||
|
||||
/// <summary>
|
||||
/// The porpose of the connection to keep track of open connections
|
||||
/// </summary>
|
||||
public string Purpose { get; set; } = ConnectionType.GeneralConnection;
|
||||
}
|
||||
}
|
||||
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionChangedNotification.cs
vendored
Normal file
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionChangedNotification.cs
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// ConnectionChanged notification mapping entry
|
||||
/// </summary>
|
||||
public class ConnectionChangedNotification
|
||||
{
|
||||
public static readonly
|
||||
EventType<ConnectionChangedParams> Type =
|
||||
EventType<ConnectionChangedParams>.Create("connection/connectionchanged");
|
||||
}
|
||||
}
|
||||
23
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionChangedParams.cs
vendored
Normal file
23
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionChangedParams.cs
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <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; }
|
||||
}
|
||||
}
|
||||
66
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionCompleteNotification.cs
vendored
Normal file
66
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionCompleteNotification.cs
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// 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.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters to be sent back with a connection complete event
|
||||
/// </summary>
|
||||
public class ConnectionCompleteParams
|
||||
{
|
||||
/// <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>
|
||||
/// A GUID representing a unique connection ID
|
||||
/// </summary>
|
||||
public string ConnectionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets any detailed connection error messages.
|
||||
/// </summary>
|
||||
public string Messages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Error message returned from the engine for a connection failure reason, if any.
|
||||
/// </summary>
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Error number returned from the engine for connection failure reason, if any.
|
||||
/// </summary>
|
||||
public int ErrorNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Information about the connected server.
|
||||
/// </summary>
|
||||
public ServerInfo ServerInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the actual Connection established, including Database Name
|
||||
/// </summary>
|
||||
public ConnectionSummary ConnectionSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of connection that this notification is for
|
||||
/// </summary>
|
||||
public string Type { get; set; } = ConnectionType.Default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ConnectionComplete notification mapping entry
|
||||
/// </summary>
|
||||
public class ConnectionCompleteNotification
|
||||
{
|
||||
public static readonly
|
||||
EventType<ConnectionCompleteParams> Type =
|
||||
EventType<ConnectionCompleteParams>.Create("connection/complete");
|
||||
}
|
||||
}
|
||||
525
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionDetails.cs
vendored
Normal file
525
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionDetails.cs
vendored
Normal file
@@ -0,0 +1,525 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Message format for the initial connection request
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If this contract is ever changed, be sure to update ConnectionDetailsExtensions methods.
|
||||
/// </remarks>
|
||||
public class ConnectionDetails : GeneralRequestDetails, IConnectionSummary
|
||||
{
|
||||
public ConnectionDetails() : base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection password
|
||||
/// </summary>
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("password");
|
||||
}
|
||||
set
|
||||
{
|
||||
SetOptionValue("password", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection server name
|
||||
/// </summary>
|
||||
public string ServerName
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("server");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("server", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection database name
|
||||
/// </summary>
|
||||
public string DatabaseName
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("database");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("database", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection user name
|
||||
/// </summary>
|
||||
public string UserName
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("user");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("user", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the authentication to use.
|
||||
/// </summary>
|
||||
public string AuthenticationType
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("authenticationType");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("authenticationType", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a Boolean value that indicates whether SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed.
|
||||
/// </summary>
|
||||
public bool? Encrypt
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<bool?>("encrypt");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("encrypt", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value that indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.
|
||||
/// </summary>
|
||||
public bool? TrustServerCertificate
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<bool?>("trustServerCertificate");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("trustServerCertificate", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a Boolean value that indicates if security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.
|
||||
/// </summary>
|
||||
public bool? PersistSecurityInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<bool?>("persistSecurityInfo");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("persistSecurityInfo", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.
|
||||
/// </summary>
|
||||
public int? ConnectTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<int?>("connectTimeout");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("connectTimeout", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of reconnections attempted after identifying that there was an idle connection failure.
|
||||
/// </summary>
|
||||
public int? ConnectRetryCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<int?>("connectRetryCount");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("connectRetryCount", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Amount of time (in seconds) between each reconnection attempt after identifying that there was an idle connection failure.
|
||||
/// </summary>
|
||||
public int? ConnectRetryInterval
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<int?>("connectRetryInterval");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("connectRetryInterval", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the application associated with the connection string.
|
||||
/// </summary>
|
||||
public string ApplicationName
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("applicationName");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("applicationName", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the workstation connecting to SQL Server.
|
||||
/// </summary>
|
||||
public string WorkstationId
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("workstationId");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("workstationId", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Declares the application workload type when connecting to a database in an SQL Server Availability Group.
|
||||
/// </summary>
|
||||
public string ApplicationIntent
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("applicationIntent");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("applicationIntent", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the SQL Server Language record name.
|
||||
/// </summary>
|
||||
public string CurrentLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("currentLanguage");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("currentLanguage", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a Boolean value that indicates whether the connection will be pooled or explicitly opened every time that the connection is requested.
|
||||
/// </summary>
|
||||
public bool? Pooling
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<bool?>("pooling");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("pooling", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of connections allowed in the connection pool for this specific connection string.
|
||||
/// </summary>
|
||||
public int? MaxPoolSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<int?>("maxPoolSize");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("maxPoolSize", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum number of connections allowed in the connection pool for this specific connection string.
|
||||
/// </summary>
|
||||
public int? MinPoolSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<int?>("minPoolSize");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("minPoolSize", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum time, in seconds, for the connection to live in the connection pool before being destroyed.
|
||||
/// </summary>
|
||||
public int? LoadBalanceTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<int?>("loadBalanceTimeout");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("loadBalanceTimeout", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a Boolean value that indicates whether replication is supported using the connection.
|
||||
/// </summary>
|
||||
public bool? Replication
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<bool?>("replication");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("replication", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a string that contains the name of the primary data file. This includes the full path name of an attachable database.
|
||||
/// </summary>
|
||||
public string AttachDbFilename
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("attachDbFilename");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("attachDbFilename", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name or address of the partner server to connect to if the primary server is down.
|
||||
/// </summary>
|
||||
public string FailoverPartner
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("failoverPartner");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("failoverPartner", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If your application is connecting to an AlwaysOn availability group (AG) on different subnets, setting MultiSubnetFailover=true provides faster detection of and connection to the (currently) active server.
|
||||
/// </summary>
|
||||
public bool? MultiSubnetFailover
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<bool?>("multiSubnetFailover");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("multiSubnetFailover", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When true, an application can maintain multiple active result sets (MARS).
|
||||
/// </summary>
|
||||
public bool? MultipleActiveResultSets
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<bool?>("multipleActiveResultSets");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("multipleActiveResultSets", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the size in bytes of the network packets used to communicate with an instance of SQL Server.
|
||||
/// </summary>
|
||||
public int? PacketSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<int?>("packetSize");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("packetSize", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the port to use for the TCP/IP connection
|
||||
/// </summary>
|
||||
public int? Port
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<int?>("port");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("port", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a string value that indicates the type system the application expects.
|
||||
/// </summary>
|
||||
public string TypeSystemVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("typeSystemVersion");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("typeSystemVersion", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a string value to be used as the connection string. If given, all other options will be ignored.
|
||||
/// </summary>
|
||||
public string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("connectionString");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("connectionString", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the group ID
|
||||
/// </summary>
|
||||
public string GroupId
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("groupId");
|
||||
}
|
||||
set
|
||||
{
|
||||
SetOptionValue("groupId", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the database display name
|
||||
/// </summary>
|
||||
public string DatabaseDisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("databaseDisplayName");
|
||||
}
|
||||
set
|
||||
{
|
||||
SetOptionValue("databaseDisplayName", value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsComparableTo(ConnectionDetails other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ServerName != other.ServerName
|
||||
|| AuthenticationType != other.AuthenticationType
|
||||
|| UserName != other.UserName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// For database name, only compare if neither is empty. This is important
|
||||
// Since it allows for handling of connections to the default database, but is
|
||||
// not a 100% accurate heuristic.
|
||||
if (!string.IsNullOrEmpty(DatabaseName)
|
||||
&& !string.IsNullOrEmpty(other.DatabaseName)
|
||||
&& DatabaseName != other.DatabaseName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
51
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionDetailsExtensions.cs
vendored
Normal file
51
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionDetailsExtensions.cs
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for the ConnectionDetails contract class
|
||||
/// </summary>
|
||||
public static class ConnectionDetailsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a copy of a connection details object.
|
||||
/// </summary>
|
||||
public static ConnectionDetails Clone(this ConnectionDetails details)
|
||||
{
|
||||
return new ConnectionDetails()
|
||||
{
|
||||
ServerName = details.ServerName,
|
||||
DatabaseName = details.DatabaseName,
|
||||
UserName = details.UserName,
|
||||
Password = details.Password,
|
||||
AuthenticationType = details.AuthenticationType,
|
||||
Encrypt = details.Encrypt,
|
||||
TrustServerCertificate = details.TrustServerCertificate,
|
||||
PersistSecurityInfo = details.PersistSecurityInfo,
|
||||
ConnectTimeout = details.ConnectTimeout,
|
||||
ConnectRetryCount = details.ConnectRetryCount,
|
||||
ConnectRetryInterval = details.ConnectRetryInterval,
|
||||
ApplicationName = details.ApplicationName,
|
||||
WorkstationId = details.WorkstationId,
|
||||
ApplicationIntent = details.ApplicationIntent,
|
||||
CurrentLanguage = details.CurrentLanguage,
|
||||
Pooling = details.Pooling,
|
||||
MaxPoolSize = details.MaxPoolSize,
|
||||
MinPoolSize = details.MinPoolSize,
|
||||
LoadBalanceTimeout = details.LoadBalanceTimeout,
|
||||
Replication = details.Replication,
|
||||
AttachDbFilename = details.AttachDbFilename,
|
||||
FailoverPartner = details.FailoverPartner,
|
||||
MultiSubnetFailover = details.MultiSubnetFailover,
|
||||
MultipleActiveResultSets = details.MultipleActiveResultSets,
|
||||
PacketSize = details.PacketSize,
|
||||
TypeSystemVersion = details.TypeSystemVersion,
|
||||
ConnectionString = details.ConnectionString,
|
||||
Port = details.Port
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionRequest.cs
vendored
Normal file
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionRequest.cs
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Connect request mapping entry
|
||||
/// </summary>
|
||||
public class ConnectionRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<ConnectParams, bool> Type =
|
||||
RequestType<ConnectParams, bool>.Create("connection/connect");
|
||||
}
|
||||
}
|
||||
48
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionSummary.cs
vendored
Normal file
48
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionSummary.cs
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
|
||||
public interface IConnectionSummary
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the connection server name
|
||||
/// </summary>
|
||||
string ServerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection database name
|
||||
/// </summary>
|
||||
string DatabaseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection user name
|
||||
/// </summary>
|
||||
string UserName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides high level information about a connection.
|
||||
/// </summary>
|
||||
public class ConnectionSummary : IConnectionSummary
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the connection server name
|
||||
/// </summary>
|
||||
public virtual string ServerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection database name
|
||||
/// </summary>
|
||||
public virtual string DatabaseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the connection user name
|
||||
/// </summary>
|
||||
public virtual string UserName { get; set; }
|
||||
}
|
||||
}
|
||||
53
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionSummaryComparer.cs
vendored
Normal file
53
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionSummaryComparer.cs
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Treats connections as the same if their server, db and usernames all match
|
||||
/// </summary>
|
||||
public class ConnectionSummaryComparer : IEqualityComparer<ConnectionSummary>
|
||||
{
|
||||
public bool Equals(ConnectionSummary x, ConnectionSummary y)
|
||||
{
|
||||
if(x == y) { return true; }
|
||||
else if(x != null)
|
||||
{
|
||||
if(y == null) { return false; }
|
||||
|
||||
// Compare server, db, username. Note: server is case-insensitive in the driver
|
||||
return string.Compare(x.ServerName, y.ServerName, StringComparison.OrdinalIgnoreCase) == 0
|
||||
&& string.Compare(x.DatabaseName, y.DatabaseName, StringComparison.Ordinal) == 0
|
||||
&& string.Compare(x.UserName, y.UserName, StringComparison.Ordinal) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int GetHashCode(ConnectionSummary obj)
|
||||
{
|
||||
int hashcode = 31;
|
||||
if(obj != null)
|
||||
{
|
||||
if(obj.ServerName != null)
|
||||
{
|
||||
hashcode ^= obj.ServerName.GetHashCode();
|
||||
}
|
||||
if (obj.DatabaseName != null)
|
||||
{
|
||||
hashcode ^= obj.DatabaseName.GetHashCode();
|
||||
}
|
||||
if (obj.UserName != null)
|
||||
{
|
||||
hashcode ^= obj.UserName.GetHashCode();
|
||||
}
|
||||
}
|
||||
return hashcode;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionSummaryExtensions.cs
vendored
Normal file
26
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionSummaryExtensions.cs
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods to ConnectionSummary
|
||||
/// </summary>
|
||||
public static class ConnectionSummaryExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a copy of a ConnectionSummary object
|
||||
/// </summary>
|
||||
public static ConnectionSummary Clone(this IConnectionSummary summary)
|
||||
{
|
||||
return new ConnectionSummary()
|
||||
{
|
||||
ServerName = summary.ServerName,
|
||||
DatabaseName = summary.DatabaseName,
|
||||
UserName = summary.UserName
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
23
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionType.cs
vendored
Normal file
23
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ConnectionType.cs
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// String constants that represent connection types.
|
||||
///
|
||||
/// Default: Connection used by the editor. Opened by the editor upon the initial connection.
|
||||
/// Query: Connection used for executing queries. Opened when the first query is executed.
|
||||
/// </summary>
|
||||
public static class ConnectionType
|
||||
{
|
||||
public const string Default = "Default";
|
||||
public const string Query = "Query";
|
||||
public const string Edit = "Edit";
|
||||
public const string ObjectExplorer = "ObjectExplorer";
|
||||
public const string Dashboard = "Dashboard";
|
||||
public const string GeneralConnection = "GeneralConnection";
|
||||
}
|
||||
}
|
||||
25
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/DisconnectParams.cs
vendored
Normal file
25
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/DisconnectParams.cs
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <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>
|
||||
/// The type of connection we are disconnecting. If null, we will disconnect all connections.
|
||||
/// connections.
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
||||
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/DisconnectRequest.cs
vendored
Normal file
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/DisconnectRequest.cs
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Disconnect request mapping entry
|
||||
/// </summary>
|
||||
public class DisconnectRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<DisconnectParams, bool> Type =
|
||||
RequestType<DisconnectParams, bool>.Create("connection/disconnect");
|
||||
}
|
||||
}
|
||||
42
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/LanguageFlavorChange.cs
vendored
Normal file
42
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/LanguageFlavorChange.cs
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// 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.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Parameters for the Language Flavor Change notification.
|
||||
/// </summary>
|
||||
public class LanguageFlavorChangeParams
|
||||
{
|
||||
/// <summary>
|
||||
/// A URI identifying the affected resource
|
||||
/// </summary>
|
||||
public string Uri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The primary language
|
||||
/// </summary>
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The specific language flavor that is being set
|
||||
/// </summary>
|
||||
public string Flavor { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an event that is sent from the client to notify that
|
||||
/// the client is exiting and the server should as well.
|
||||
/// </summary>
|
||||
public class LanguageFlavorChangeNotification
|
||||
{
|
||||
public static readonly
|
||||
EventType<LanguageFlavorChangeParams> Type =
|
||||
EventType<LanguageFlavorChangeParams>.Create("connection/languageflavorchanged");
|
||||
}
|
||||
}
|
||||
18
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ListDatabasesParams.cs
vendored
Normal file
18
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ListDatabasesParams.cs
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for the List Databases Request.
|
||||
/// </summary>
|
||||
public class ListDatabasesParams
|
||||
{
|
||||
/// <summary>
|
||||
/// URI of the owner of the connection requesting the list of databases.
|
||||
/// </summary>
|
||||
public string OwnerUri { get; set; }
|
||||
}
|
||||
}
|
||||
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ListDatabasesRequest.cs
vendored
Normal file
19
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ListDatabasesRequest.cs
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// List databases request mapping entry
|
||||
/// </summary>
|
||||
public class ListDatabasesRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<ListDatabasesParams, ListDatabasesResponse> Type =
|
||||
RequestType<ListDatabasesParams, ListDatabasesResponse>.Create("connection/listdatabases");
|
||||
}
|
||||
}
|
||||
18
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ListDatabasesResponse.cs
vendored
Normal file
18
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ListDatabasesResponse.cs
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Message format for the list databases response
|
||||
/// </summary>
|
||||
public class ListDatabasesResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the list of database names.
|
||||
/// </summary>
|
||||
public string[] DatabaseNames { get; set; }
|
||||
}
|
||||
}
|
||||
68
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ServerInfo.cs
vendored
Normal file
68
external/Microsoft.SqlTools.DataProtocol.Contracts/Connection/ServerInfo.cs
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.DataProtocol.Contracts.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Contract for information on the connected SQL Server instance.
|
||||
/// </summary>
|
||||
public class ServerInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The major version of the SQL Server instance.
|
||||
/// </summary>
|
||||
public int ServerMajorVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The minor version of the SQL Server instance.
|
||||
/// </summary>
|
||||
public int ServerMinorVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The build of the SQL Server instance.
|
||||
/// </summary>
|
||||
public int ServerReleaseVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the engine edition of the SQL Server instance.
|
||||
/// </summary>
|
||||
public int EngineEditionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// String containing the full server version text.
|
||||
/// </summary>
|
||||
public string ServerVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// String describing the product level of the server.
|
||||
/// </summary>
|
||||
public string ServerLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The edition of the SQL Server instance.
|
||||
/// </summary>
|
||||
public string ServerEdition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the SQL Server instance is running in the cloud (Azure) or not.
|
||||
/// </summary>
|
||||
public bool IsCloud { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The version of Azure that the SQL Server instance is running on, if applicable.
|
||||
/// </summary>
|
||||
public int AzureVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Operating System version string of the machine running the SQL Server instance.
|
||||
/// </summary>
|
||||
public string OsVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Operating System version string of the machine running the SQL Server instance.
|
||||
/// </summary>
|
||||
public string MachineName { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user