mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-19 09:35:36 -05:00
Feature/reliable connection (#44)
* Initial commit of reliable connection port * Made ReliableSqlConnection inherit from DbConnection instead of IDbConnection * Cleanup * Fixed autocomplete service to use reliable connection * Fix copyright headers * Renamed ConnectResponse.Server to ServerInfo * Removed unused using * Addressing code review feedback
This commit is contained in:
@@ -11,6 +11,7 @@ using System.Data.SqlClient;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.EditorServices.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection;
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace;
|
||||
@@ -185,6 +186,29 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
activity(connectionInfo);
|
||||
}
|
||||
|
||||
// try to get information about the connected SQL Server instance
|
||||
try
|
||||
{
|
||||
ReliableConnectionHelper.ServerInfo serverInfo = ReliableConnectionHelper.GetServerVersion(connectionInfo.SqlConnection);
|
||||
response.ServerInfo = new Contracts.ServerInfo()
|
||||
{
|
||||
ServerMajorVersion = serverInfo.ServerMajorVersion,
|
||||
ServerMinorVersion = serverInfo.ServerMinorVersion,
|
||||
ServerReleaseVersion = serverInfo.ServerReleaseVersion,
|
||||
EngineEditionId = serverInfo.EngineEditionId,
|
||||
ServerVersion = serverInfo.ServerVersion,
|
||||
ServerLevel = serverInfo.ServerLevel,
|
||||
ServerEdition = serverInfo.ServerEdition,
|
||||
IsCloud = serverInfo.IsCloud,
|
||||
AzureVersion = serverInfo.AzureVersion,
|
||||
OsVersion = serverInfo.OsVersion
|
||||
};
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
response.Messages = ex.ToString();
|
||||
}
|
||||
|
||||
// return the connection result
|
||||
response.ConnectionId = connectionInfo.ConnectionId.ToString();
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user