Add group id and db display name to OE connection queue key (#531)

This commit is contained in:
Karl Burtram
2017-10-26 10:56:22 -07:00
committed by GitHub
parent 4c329921c7
commit 7ccf78aec1
3 changed files with 44 additions and 2 deletions

View File

@@ -467,7 +467,35 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
}
}
/// <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)
{

View File

@@ -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;
}
/// <summary>

View File

@@ -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;
}