mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Quick refactor of the connection service
Refactoring to match the layout of the other services.
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Connection
|
namespace Microsoft.SqlTools.ServiceLayer.ConnectionServices.Contracts
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Message format for the initial connection request
|
/// Message format for the initial connection request
|
||||||
@@ -5,19 +5,8 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Connection
|
namespace Microsoft.SqlTools.ServiceLayer.ConnectionServices.Contracts
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Interface for the SQL Connection factory
|
|
||||||
/// </summary>
|
|
||||||
public interface ISqlConnectionFactory
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Create a new SQL Connection object
|
|
||||||
/// </summary>
|
|
||||||
ISqlConnection CreateSqlConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface for the SQL Connection wrapper
|
/// Interface for the SQL Connection wrapper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -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.ConnectionServices.Contracts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for the SQL Connection factory
|
||||||
|
/// </summary>
|
||||||
|
public interface ISqlConnectionFactory
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new SQL Connection object
|
||||||
|
/// </summary>
|
||||||
|
ISqlConnection CreateSqlConnection();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,24 +7,8 @@ using System.Collections.Generic;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Connection
|
namespace Microsoft.SqlTools.ServiceLayer.ConnectionServices.Contracts
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Factory class to create SqlClientConnections
|
|
||||||
/// The purpose of the factory is to make it easier to mock out the database
|
|
||||||
/// in 'offline' unit test scenarios.
|
|
||||||
/// </summary>
|
|
||||||
public class SqlConnectionFactory : ISqlConnectionFactory
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new SqlClientConnection object
|
|
||||||
/// </summary>
|
|
||||||
public ISqlConnection CreateSqlConnection()
|
|
||||||
{
|
|
||||||
return new SqlClientConnection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wrapper class that implements ISqlConnection and hosts a SqlConnection.
|
/// Wrapper class that implements ISqlConnection and hosts a SqlConnection.
|
||||||
/// This wrapper exists primarily for decoupling to support unit testing.
|
/// This wrapper exists primarily for decoupling to support unit testing.
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// 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.ConnectionServices.Contracts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Factory class to create SqlClientConnections
|
||||||
|
/// The purpose of the factory is to make it easier to mock out the database
|
||||||
|
/// in 'offline' unit test scenarios.
|
||||||
|
/// </summary>
|
||||||
|
public class SqlConnectionFactory : ISqlConnectionFactory
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new SqlClientConnection object
|
||||||
|
/// </summary>
|
||||||
|
public ISqlConnection CreateSqlConnection()
|
||||||
|
{
|
||||||
|
return new SqlClientConnection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user