mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-22 09:35:38 -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:
50
external/Microsoft.SqlTools.CoreServices/Connection/ConnectParamsExtensions.cs
vendored
Normal file
50
external/Microsoft.SqlTools.CoreServices/Connection/ConnectParamsExtensions.cs
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// 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.DataProtocol.Contracts.Connection;
|
||||
|
||||
namespace Microsoft.SqlTools.CoreServices.Connection
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods to ConnectParams
|
||||
/// </summary>
|
||||
public static class ConnectParamsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Check that the fields in ConnectParams are all valid
|
||||
/// </summary>
|
||||
public static bool IsValid(this ConnectParams parameters, out string errorMessage)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
if (string.IsNullOrEmpty(parameters.OwnerUri))
|
||||
{
|
||||
errorMessage = SR.ConnectionParamsValidateNullOwnerUri;
|
||||
}
|
||||
else if (parameters.Connection == null)
|
||||
{
|
||||
errorMessage = SR.ConnectionParamsValidateNullConnection;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(parameters.Connection.ConnectionString))
|
||||
{
|
||||
// Do not check other connection parameters if a connection string is present
|
||||
return string.IsNullOrEmpty(errorMessage);
|
||||
}
|
||||
else if (string.IsNullOrEmpty(parameters.Connection.ServerName))
|
||||
{
|
||||
errorMessage = SR.ConnectionParamsValidateNullServerName;
|
||||
}
|
||||
else if (string.IsNullOrEmpty(parameters.Connection.AuthenticationType) || parameters.Connection.AuthenticationType == "SqlLogin")
|
||||
{
|
||||
// For SqlLogin, username cannot be empty
|
||||
if (string.IsNullOrEmpty(parameters.Connection.UserName))
|
||||
{
|
||||
errorMessage = SR.ConnectionParamsValidateNullSqlAuth("UserName");
|
||||
}
|
||||
}
|
||||
|
||||
return string.IsNullOrEmpty(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user