Connect should return actual DB Name (#42)

- On Connecting to a server with no DB specified, we will actually get a connection to Master or some default DB.
- This DB should be used when notifying others of a new connection, and when returning information to the caller so that the correct name can be displayed in the UI.
- Added basic unit tests to cover this scenario
This commit is contained in:
Kevin Cunnane
2016-09-12 11:32:02 -07:00
committed by GitHub
parent 9e492f19f9
commit 14b6348b20
3 changed files with 53 additions and 0 deletions

View File

@@ -169,6 +169,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
ownerToConnectionMap[connectionParams.OwnerUri] = connectionInfo;
// Update with the actual database name in connectionInfo and result
// Doing this here as we know the connection is open - expect to do this only on connecting
connectionInfo.ConnectionDetails.DatabaseName = connectionInfo.SqlConnection.Database;
response.ConnectionSummary = new ConnectionSummary()
{
ServerName = connectionInfo.ConnectionDetails.ServerName,
DatabaseName = connectionInfo.ConnectionDetails.DatabaseName,
UserName = connectionInfo.ConnectionDetails.UserName,
};
// invoke callback notifications
foreach (var activity in this.onConnectionActivities)
{