From 7ccf78aec19602e595ceeed999aa03145d1737d2 Mon Sep 17 00:00:00 2001 From: Karl Burtram Date: Thu, 26 Oct 2017 10:56:22 -0700 Subject: [PATCH] Add group id and db display name to OE connection queue key (#531) --- .../Connection/Contracts/ConnectionDetails.cs | 30 ++++++++++++++++++- .../LanguageServices/ConnectedBindingQueue.cs | 14 ++++++++- .../ObjectExplorer/ObjectExplorerService.cs | 2 ++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.SqlTools.ServiceLayer/Connection/Contracts/ConnectionDetails.cs b/src/Microsoft.SqlTools.ServiceLayer/Connection/Contracts/ConnectionDetails.cs index 5851bf26..c7347021 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Connection/Contracts/ConnectionDetails.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Connection/Contracts/ConnectionDetails.cs @@ -467,7 +467,35 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts } } - + /// + /// Gets or sets the group ID + /// + public string GroupId + { + get + { + return GetOptionValue("groupId"); + } + set + { + SetOptionValue("groupId", value); + } + } + + /// + /// Gets or sets the database display name + /// + public string DatabaseDisplayName + { + get + { + return GetOptionValue("databaseDisplayName"); + } + set + { + SetOptionValue("databaseDisplayName", value); + } + } public bool IsComparableTo(ConnectionDetails other) { diff --git a/src/Microsoft.SqlTools.ServiceLayer/LanguageServices/ConnectedBindingQueue.cs b/src/Microsoft.SqlTools.ServiceLayer/LanguageServices/ConnectedBindingQueue.cs index 14f93fe6..c1d23ca2 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/LanguageServices/ConnectedBindingQueue.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/LanguageServices/ConnectedBindingQueue.cs @@ -72,12 +72,24 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices private string GetConnectionContextKey(ConnectionInfo connInfo) { ConnectionDetails details = connInfo.ConnectionDetails; - return string.Format("{0}_{1}_{2}_{3}", + string key = string.Format("{0}_{1}_{2}_{3}", details.ServerName ?? "NULL", details.DatabaseName ?? "NULL", details.UserName ?? "NULL", details.AuthenticationType ?? "NULL" ); + + if (!string.IsNullOrEmpty(details.DatabaseDisplayName)) + { + key += "_" + details.DatabaseDisplayName; + } + + if (!string.IsNullOrEmpty(details.GroupId)) + { + key += "_" + details.GroupId; + } + + return key; } /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs index 781aaa65..0a5da3b3 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/ObjectExplorer/ObjectExplorerService.cs @@ -605,6 +605,8 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer string uri = string.Format(CultureInfo.InvariantCulture, "{0}{1}", uriPrefix, Uri.EscapeUriString(details.ServerName)); uri = AppendIfExists(uri, "databaseName", details.DatabaseName); uri = AppendIfExists(uri, "user", details.UserName); + uri = AppendIfExists(uri, "groupId", details.GroupId); + uri = AppendIfExists(uri, "displayName", details.DatabaseDisplayName); return uri; }