mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Restore new connection string for multiple similar connections (#2067)
This commit is contained in:
@@ -1044,7 +1044,29 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.Close();
|
||||
bool disconnect = false;
|
||||
if (connection.ConnectionString != null){
|
||||
int totalCount = 0;
|
||||
foreach (KeyValuePair<string, ConnectionInfo> entry in OwnerToConnectionMap)
|
||||
{
|
||||
foreach (DbConnection value in entry.Value.AllConnections) {
|
||||
if(value.ConnectionString == connection.ConnectionString) {
|
||||
totalCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(totalCount == 1) {
|
||||
disconnect = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
disconnect = true;
|
||||
}
|
||||
|
||||
if(disconnect) {
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user