mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-24 17:24:14 -05:00
Added request to list databases on the server for the current connection
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for the ConnectionDetails contract class
|
||||
/// </summary>
|
||||
public static class ConnectionDetailsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a copy of a connection details object.
|
||||
/// </summary>
|
||||
public static ConnectionDetails Clone(this ConnectionDetails details)
|
||||
{
|
||||
return new ConnectionDetails()
|
||||
{
|
||||
ServerName = details.ServerName,
|
||||
DatabaseName = details.DatabaseName,
|
||||
UserName = details.UserName,
|
||||
Password = details.Password
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for the List Databases Request.
|
||||
/// </summary>
|
||||
public class ListDatabasesParams
|
||||
{
|
||||
/// <summary>
|
||||
/// URI of the owner of the connection requesting the list of databases.
|
||||
/// </summary>
|
||||
public string OwnerUri;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// List databases request mapping entry
|
||||
/// </summary>
|
||||
public class ListDatabasesRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<ListDatabasesParams, ListDatabasesResponse> Type =
|
||||
RequestType<ListDatabasesParams, ListDatabasesResponse>.Create("connection/listdatabases");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Message format for the list databases response
|
||||
/// </summary>
|
||||
public class ListDatabasesResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the list of database names.
|
||||
/// </summary>
|
||||
public string[] DatabaseNames { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user