mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-20 17:24:00 -05:00
Move unused forked code to external directory (#1192)
* Move unused forked code to external directory * Fix SLN build errors * Add back resource provider core since it's referenced by main resource provider project * Update PackageProjects step of pipeline
This commit is contained in:
31
external/Microsoft.SqlTools.CoreServices/Connection/ConnectionUtils.cs
vendored
Normal file
31
external/Microsoft.SqlTools.CoreServices/Connection/ConnectionUtils.cs
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
|
||||
using System.Data.Common;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.SqlTools.CoreServices.Connection.ReliableConnection;
|
||||
|
||||
public static class ConnectionUtils
|
||||
{
|
||||
public static SqlConnection GetAsSqlConnection(DbConnection connection)
|
||||
{
|
||||
SqlConnection sqlConn = connection as SqlConnection;
|
||||
if (sqlConn == null)
|
||||
{
|
||||
// It's not actually a SqlConnection, so let's try a reliable SQL connection
|
||||
ReliableSqlConnection reliableConn = connection as ReliableSqlConnection;
|
||||
if (reliableConn == null)
|
||||
{
|
||||
// If we don't have connection we can use with SMO, just give up on using SMO
|
||||
return null;
|
||||
}
|
||||
|
||||
// We have a reliable connection, use the underlying connection
|
||||
sqlConn = reliableConn.GetUnderlyingConnection();
|
||||
}
|
||||
return sqlConn;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user