Improve this Doc
View Source
Main class for the Connection Management services
Inheritance
System.Object
ConnectionService
Namespace:Microsoft.SqlTools.ServiceLayer.Connection
Assembly:Microsoft.SqlTools.ServiceLayer.dll
public class ConnectionService
Constructors
|
Improve this Doc
View Source
Default constructor should be private since it's a singleton class, but we need a constructor
for use in unit test mocking.
Declaration
public ConnectionService()
|
Improve this Doc
View Source
Test constructor that injects dependency interfaces
Declaration
public ConnectionService(ISqlConnectionFactory testFactory)
Parameters
Properties
|
Improve this Doc
View Source
Gets the SQL connection factory instance
Declaration
public ISqlConnectionFactory ConnectionFactory { get; }
|
Improve this Doc
View Source
Gets the singleton service instance
Declaration
public static ConnectionService Instance { get; }
Methods
|
Improve this Doc
View Source
Build a connection string from a connection details instance
Declaration
public static string BuildConnectionString(ConnectionDetails connectionDetails)
Parameters
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Cancel a connection that is in the process of opening.
Declaration
public bool CancelConnect(CancelConnectParams cancelParams)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ChangeConnectionDatabaseContext(String, String)
Change the database context of a connection.
Declaration
public void ChangeConnectionDatabaseContext(string ownerUri, string newDatabaseName)
Parameters
Type |
Name |
Description |
System.String |
ownerUri |
URI of the owner of the connection
|
System.String |
newDatabaseName |
Name of the database to change the connection to
|
|
Improve this Doc
View Source
Open a connection with the specified connection details
Declaration
public Task<ConnectionCompleteParams> Connect(ConnectParams connectionParams)
Parameters
Returns
|
Improve this Doc
View Source
Close a connection with the specified connection details.
Declaration
public bool Disconnect(DisconnectParams disconnectParams)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
HandleCancelConnectRequest(CancelConnectParams, RequestContext<Boolean>)
Handle cancel connect requests
Declaration
protected Task HandleCancelConnectRequest(CancelConnectParams cancelParams, RequestContext<bool> requestContext)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this Doc
View Source
HandleConnectRequest(ConnectParams, RequestContext<Boolean>)
Handle new connection requests
Declaration
protected Task HandleConnectRequest(ConnectParams connectParams, RequestContext<bool> requestContext)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this Doc
View Source
HandleDidChangeConfigurationNotification(SqlToolsSettings, SqlToolsSettings, EventContext)
Declaration
public Task HandleDidChangeConfigurationNotification(SqlToolsSettings newSettings, SqlToolsSettings oldSettings, EventContext eventContext)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this Doc
View Source
HandleDisconnectRequest(DisconnectParams, RequestContext<Boolean>)
Handle disconnect requests
Declaration
protected Task HandleDisconnectRequest(DisconnectParams disconnectParams, RequestContext<bool> requestContext)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this Doc
View Source
HandleListDatabasesRequest(ListDatabasesParams, RequestContext<ListDatabasesResponse>)
Handle requests to list databases on the current server
Declaration
protected Task HandleListDatabasesRequest(ListDatabasesParams listDatabasesParams, RequestContext<ListDatabasesResponse> requestContext)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
|
Improve this Doc
View Source
Declaration
public void InitializeService(IProtocolEndpoint serviceHost)
Parameters
|
Improve this Doc
View Source
List all databases on the server specified
Declaration
public ListDatabasesResponse ListDatabases(ListDatabasesParams listDatabasesParams)
Parameters
Returns
|
Improve this Doc
View Source
Add a new method to be called when the onconnection request is submitted
Declaration
public void RegisterOnConnectionTask(ConnectionService.OnConnectionHandler activity)
Parameters
|
Improve this Doc
View Source
Add a new method to be called when the ondisconnect request is submitted
Declaration
public void RegisterOnDisconnectTask(ConnectionService.OnDisconnectHandler activity)
Parameters
|
Improve this Doc
View Source
Declaration
public virtual bool TryFindConnection(string ownerUri, out ConnectionInfo connectionInfo)
Parameters
Type |
Name |
Description |
System.String |
ownerUri |
|
ConnectionInfo |
connectionInfo |
|
Returns
Type |
Description |
System.Boolean |
|