Adding missing properties to GetProjectProperties call; also renaming NoneScript to NoneItem (#1890)

* Renaming NoneScript to NoneItem

* missed a file

* Fixing comments

* Adding ProjectStyle to properties

* Projects nuget bump

* Adding DatabaseSchemaProvider to the props
This commit is contained in:
Benjin Dubishar
2023-03-02 13:52:35 -08:00
committed by GitHub
parent 5f78eaa41f
commit 38836371ed
17 changed files with 88 additions and 61 deletions

View File

@@ -11,6 +11,9 @@ using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Get all the database references in a project
/// </summary>
public class GetDatabaseReferencesRequest
{
public static readonly RequestType<SqlProjectParams, GetDatabaseReferencesResult> Type = RequestType<SqlProjectParams, GetDatabaseReferencesResult>.Create("sqlProjects/getDatabaseReferences");

View File

@@ -10,6 +10,9 @@ using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Get all the folders in a project
/// </summary>
public class GetFoldersRequest
{
public static readonly RequestType<SqlProjectParams, GetFoldersResult> Type = RequestType<SqlProjectParams, GetFoldersResult>.Create("sqlProjects/getFolders");

View File

@@ -9,10 +9,10 @@ using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Add a SQL object script to a project
/// Add a None item to a project
/// </summary>
public class AddNoneScriptRequest
public class AddNoneItemRequest
{
public static readonly RequestType<SqlProjectScriptParams, ResultStatus> Type = RequestType<SqlProjectScriptParams, ResultStatus>.Create("sqlProjects/addNoneScript");
public static readonly RequestType<SqlProjectScriptParams, ResultStatus> Type = RequestType<SqlProjectScriptParams, ResultStatus>.Create("sqlProjects/addNoneItem");
}
}

View File

@@ -4,15 +4,15 @@
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Delete a SQL object script from a project
/// Delete a None item from a project
/// </summary>
public class DeleteNoneScriptRequest
public class DeleteNoneItemRequest
{
public static readonly RequestType<SqlProjectScriptParams, ResultStatus> Type = RequestType<SqlProjectScriptParams, ResultStatus>.Create("sqlProjects/deleteNoneScript");
public static readonly RequestType<SqlProjectScriptParams, ResultStatus> Type = RequestType<SqlProjectScriptParams, ResultStatus>.Create("sqlProjects/deleteNoneItem");
}
}

View File

@@ -9,10 +9,10 @@ using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Exclude a SQL object script from a project
/// Exclude a None item from a project
/// </summary>
public class ExcludeNoneScriptRequest
public class ExcludeNoneItemRequest
{
public static readonly RequestType<SqlProjectScriptParams, ResultStatus> Type = RequestType<SqlProjectScriptParams, ResultStatus>.Create("sqlProjects/excludeNoneScript");
public static readonly RequestType<SqlProjectScriptParams, ResultStatus> Type = RequestType<SqlProjectScriptParams, ResultStatus>.Create("sqlProjects/excludeNoneItem");
}
}

View File

@@ -3,14 +3,15 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
public class GetNoneScriptsRequest
/// <summary>
/// Get all the None items in a project
/// </summary>
public class GetNoneItemsRequest
{
public static readonly RequestType<SqlProjectParams, GetScriptsResult> Type = RequestType<SqlProjectParams, GetScriptsResult>.Create("sqlProjects/getNoneScripts");
public static readonly RequestType<SqlProjectParams, GetScriptsResult> Type = RequestType<SqlProjectParams, GetScriptsResult>.Create("sqlProjects/getNoneItems");
}
}

View File

@@ -3,18 +3,16 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Move a SQL object script in a project
/// Move a None item in a project
/// </summary>
public class MoveNoneScriptRequest
public class MoveNoneItemRequest
{
public static readonly RequestType<MoveItemParams, ResultStatus> Type = RequestType<MoveItemParams, ResultStatus>.Create("sqlProjects/moveNoneScript");
public static readonly RequestType<MoveItemParams, ResultStatus> Type = RequestType<MoveItemParams, ResultStatus>.Create("sqlProjects/moveNoneItem");
}
}

View File

@@ -3,12 +3,13 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Get all the post-deployment scripts in a project
/// </summary>
public class GetPostDeploymentScriptsRequest
{
public static readonly RequestType<SqlProjectParams, GetScriptsResult> Type = RequestType<SqlProjectParams, GetScriptsResult>.Create("sqlProjects/getPostDeploymentScripts");

View File

@@ -3,12 +3,13 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Get all the pre-deployment scripts in a project
/// </summary>
public class GetPreDeploymentScriptsRequest
{
public static readonly RequestType<SqlProjectParams, GetScriptsResult> Type = RequestType<SqlProjectParams, GetScriptsResult>.Create("sqlProjects/getPreDeploymentScripts");

View File

@@ -3,6 +3,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Dac.Projects;
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using Microsoft.SqlTools.ServiceLayer.Utility;
@@ -54,5 +55,14 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
/// </summary>
public string? DatabaseSource { get; set; }
/// <summary>
/// Style of the .sqlproj file - SdkStyle or LegacyStyle
/// </summary>
public ProjectType ProjectStyle { get; set; }
/// <summary>
/// Database Schema Provider, in the format "Microsoft.Data.Tools.Schema.Sql.SqlXYZDatabaseSchemaProvider"
/// </summary>
public string DatabaseSchemaProvider { get; set; }
}
}

View File

@@ -11,6 +11,9 @@ using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Get all the SQLCMD variables in a project
/// </summary>
public class GetSqlCmdVariablesRequest
{
public static readonly RequestType<SqlProjectParams, GetSqlCmdVariablesResult> Type = RequestType<SqlProjectParams, GetSqlCmdVariablesResult>.Create("sqlProjects/getSqlCmdVariables");

View File

@@ -10,6 +10,9 @@ using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlProjects.Contracts
{
/// <summary>
/// Get all the SQL object scripts in a project
/// </summary>
public class GetSqlObjectScriptsRequest
{
public static readonly RequestType<SqlProjectParams, GetScriptsResult> Type = RequestType<SqlProjectParams, GetScriptsResult>.Create("sqlProjects/getSqlObjectScripts");

View File

@@ -70,11 +70,11 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlProjects
serviceHost.SetRequestHandler(MovePostDeploymentScriptRequest.Type, HandleMovePostDeploymentScriptRequest, isParallelProcessingSupported: false);
// None script functions
serviceHost.SetRequestHandler(GetNoneScriptsRequest.Type, HandleGetNoneScriptsRequest, isParallelProcessingSupported: true);
serviceHost.SetRequestHandler(AddNoneScriptRequest.Type, HandleAddNoneScriptRequest, isParallelProcessingSupported: false);
serviceHost.SetRequestHandler(DeleteNoneScriptRequest.Type, HandleDeleteNoneScriptRequest, isParallelProcessingSupported: false);
serviceHost.SetRequestHandler(ExcludeNoneScriptRequest.Type, HandleExcludeNoneScriptRequest, isParallelProcessingSupported: false);
serviceHost.SetRequestHandler(MoveNoneScriptRequest.Type, HandleMoveNoneScriptRequest, isParallelProcessingSupported: false);
serviceHost.SetRequestHandler(GetNoneItemsRequest.Type, HandleGetNoneItemsRequest, isParallelProcessingSupported: true);
serviceHost.SetRequestHandler(AddNoneItemRequest.Type, HandleAddNoneItemRequest, isParallelProcessingSupported: false);
serviceHost.SetRequestHandler(DeleteNoneItemRequest.Type, HandleDeleteNoneItemRequest, isParallelProcessingSupported: false);
serviceHost.SetRequestHandler(ExcludeNoneItemRequest.Type, HandleExcludeNoneItemRequest, isParallelProcessingSupported: false);
serviceHost.SetRequestHandler(MoveNoneItemRequest.Type, HandleMoveNoneItemRequest, isParallelProcessingSupported: false);
// Folder functions
serviceHost.SetRequestHandler(GetFoldersRequest.Type, HandleGetFoldersRequest, isParallelProcessingSupported: true);
@@ -139,18 +139,20 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlProjects
{
await RunWithErrorHandling(() =>
{
SqlProjectProperties props = GetProject(requestParams.ProjectUri).Properties;
SqlProject project = GetProject(requestParams.ProjectUri);
return new GetProjectPropertiesResult()
{
Success = true,
ErrorMessage = null,
ProjectGuid = props.ProjectGuid,
Configuration = props.Configuration,
Platform = props.Platform,
OutputPath = props.OutputPath,
DefaultCollation = props.DefaultCollation,
DatabaseSource = props.DatabaseSource,
ProjectGuid = project.Properties.ProjectGuid,
Configuration = project.Properties.Configuration,
Platform = project.Properties.Platform,
OutputPath = project.Properties.OutputPath,
DefaultCollation = project.Properties.DefaultCollation,
DatabaseSource = project.Properties.DatabaseSource,
ProjectStyle = project.SqlProjStyle,
DatabaseSchemaProvider = project.DatabaseSchemaProvider
};
}, requestContext);
}
@@ -273,7 +275,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlProjects
#region None script functions
internal async Task HandleGetNoneScriptsRequest(SqlProjectParams requestParams, RequestContext<GetScriptsResult> requestContext)
internal async Task HandleGetNoneItemsRequest(SqlProjectParams requestParams, RequestContext<GetScriptsResult> requestContext)
{
await RunWithErrorHandling(() =>
{
@@ -286,22 +288,22 @@ namespace Microsoft.SqlTools.ServiceLayer.SqlProjects
}, requestContext);
}
internal async Task HandleAddNoneScriptRequest(SqlProjectScriptParams requestParams, RequestContext<ResultStatus> requestContext)
internal async Task HandleAddNoneItemRequest(SqlProjectScriptParams requestParams, RequestContext<ResultStatus> requestContext)
{
await RunWithErrorHandling(() => GetProject(requestParams.ProjectUri).NoneScripts.Add(new NoneScript(requestParams.Path!)), requestContext);
}
internal async Task HandleDeleteNoneScriptRequest(SqlProjectScriptParams requestParams, RequestContext<ResultStatus> requestContext)
internal async Task HandleDeleteNoneItemRequest(SqlProjectScriptParams requestParams, RequestContext<ResultStatus> requestContext)
{
await RunWithErrorHandling(() => GetProject(requestParams.ProjectUri).NoneScripts.Delete(requestParams.Path!), requestContext);
}
internal async Task HandleExcludeNoneScriptRequest(SqlProjectScriptParams requestParams, RequestContext<ResultStatus> requestContext)
internal async Task HandleExcludeNoneItemRequest(SqlProjectScriptParams requestParams, RequestContext<ResultStatus> requestContext)
{
await RunWithErrorHandling(() => GetProject(requestParams.ProjectUri).NoneScripts.Exclude(requestParams.Path!), requestContext);
}
internal async Task HandleMoveNoneScriptRequest(MoveItemParams requestParams, RequestContext<ResultStatus> requestContext)
internal async Task HandleMoveNoneItemRequest(MoveItemParams requestParams, RequestContext<ResultStatus> requestContext)
{
await RunWithErrorHandling(() => GetProject(requestParams.ProjectUri).NoneScripts.Move(requestParams.Path, requestParams.DestinationPath), requestContext);
}