Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing more restore connection issues #488

Merged
merged 1 commit into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public virtual async Task<ConnectionCompleteParams> Connect(ConnectParams connec

TrySetConnectionType(connectionParams);

connectionParams.Connection.ApplicationName = GetApplicationNameWithFeature(connectionParams.Connection.ApplicationName, connectionParams.Type);
connectionParams.Connection.ApplicationName = GetApplicationNameWithFeature(connectionParams.Connection.ApplicationName, connectionParams.Purpose);
// If there is no ConnectionInfo in the map, create a new ConnectionInfo,
// but wait until later when we are connected to add it to the map.
ConnectionInfo connectionInfo;
Expand Down Expand Up @@ -317,7 +317,7 @@ private void TryCloseConnectionTemporaryConnection(ConnectParams connectionParam
{
try
{
if (connectionParams.Type == ConnectionType.ObjectExplorer || connectionParams.Type == ConnectionType.Dashboard || connectionParams.Type == ConnectionType.ConnectionValidation)
if (connectionParams.Purpose == ConnectionType.ObjectExplorer || connectionParams.Purpose == ConnectionType.Dashboard || connectionParams.Purpose == ConnectionType.GeneralConnection)
{
DbConnection connection;
string type = connectionParams.Type;
Expand All @@ -344,7 +344,7 @@ private static string GetApplicationNameWithFeature(string applicationName, stri
string appName = applicationName;
if (index > 0)
{
appName = applicationName.Substring(0, index - 1);
appName = applicationName.Substring(0, index);
}
appNameWithFeature = $"{appName}-{featureName}";
}
Expand All @@ -358,13 +358,17 @@ private void TrySetConnectionType(ConnectParams connectionParams)
{
if (connectionParams.OwnerUri.ToLowerInvariant().StartsWith("dashboard://"))
{
connectionParams.Type = ConnectionType.Dashboard;
connectionParams.Purpose = ConnectionType.Dashboard;
}
else if (connectionParams.OwnerUri.ToLowerInvariant().StartsWith("connection://"))
{
connectionParams.Type = ConnectionType.ConnectionValidation;
connectionParams.Purpose = ConnectionType.GeneralConnection;
}
}
else if (connectionParams != null)
{
connectionParams.Purpose = connectionParams.Type;
}
}

private bool IsConnectionChanged(ConnectParams connectionParams, ConnectionInfo connectionInfo)
Expand Down Expand Up @@ -1156,6 +1160,7 @@ public static SqlConnectionStringBuilder CreateConnectionStringBuilder(Connectio
{
connectionBuilder.TypeSystemVersion = connectionDetails.TypeSystemVersion;
}
connectionBuilder.Pooling = false;

return connectionBuilder;
}
Expand Down Expand Up @@ -1209,7 +1214,7 @@ public void ChangeConnectionDatabaseContext(string ownerUri, string newDatabaseN
/// </summary>
private void InvokeOnConnectionActivities(ConnectionInfo connectionInfo, ConnectParams connectParams)
{
if (connectParams.Type != ConnectionType.Default && connectParams.Type != ConnectionType.ConnectionValidation)
if (connectParams.Type != ConnectionType.Default && connectParams.Type != ConnectionType.GeneralConnection)
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public static class ConnectionType
public const string Edit = "Edit";
public const string ObjectExplorer = "ObjectExplorer";
public const string Dashboard = "Dashboard";
public const string ConnectionValidation = "ConnectionValidation";
public const string GeneralConnection = "GeneralConnection";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@ public class ConnectParams
/// 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;
}
}