mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 17:23:38 -05:00
Add scripting API implemented by the SqlScriptPublishModel (#316)
Update the ScriptingService to expose new scripting JSON-RPC APIs that use the SqlScriptPublishModel for script generation. The SqlScriptPublishModel is the model behind the SSMS scripting wizard. To enable scripting for CLI tools, we've ported SqlScriptPublishModel to .NET Core. The SqlScriptPublishModel wraps the SMO scripting APIs for .sql script generation. 1) Added three new requests to the ScriptingService: ScriptingRequest, ScriptingListObjectsRequest, ScriptingCancelRequest. 2) Generating scripts are long running operations, so the ScriptingRequest and ScriptingListObjectsRequest kick off a long running scripting task and return immediately. 3) Long running scripting task reports progress and completion, and can be cancelled by a ScriptingCancelRequest request. 4) Bumped the SMO nuget package to 140.17049.0. This new version contains a signed SSMS_Rel build of SMO with the SqlScriptPublishModel. 5) For testing, adding the Northwind database schema TODO (in later pull requests) 1) Integrate the new ScriptingService APIs with the ConnectionService 2) Integrate with the metadata support recently added
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// 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.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters to cancel a scripting request.
|
||||
/// </summary>
|
||||
public class ScriptingCancelParams : ScriptingEventParams { }
|
||||
|
||||
/// <summary>
|
||||
/// Parameters returned from a scripting request.
|
||||
/// </summary>
|
||||
public class ScriptingCancelResult { }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the scripting cancel request type.
|
||||
/// </summary>
|
||||
public class ScriptingCancelRequest
|
||||
{
|
||||
public static readonly RequestType<ScriptingCancelParams, ScriptingCancelResult> Type =
|
||||
RequestType<ScriptingCancelParams, ScriptingCancelResult>.Create("scripting/scriptCancel");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// 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.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters sent to when a scripting operation has completed.
|
||||
/// </summary>
|
||||
public class ScriptingCompleteParams : ScriptingEventParams
|
||||
{
|
||||
public string ErrorDetails { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public bool HasError { get; set; }
|
||||
|
||||
public bool Canceled { get; set; }
|
||||
|
||||
public bool Success { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event sent to indicate a scripting operation has completed.
|
||||
/// </summary>
|
||||
public class ScriptingCompleteEvent
|
||||
{
|
||||
public static readonly EventType<ScriptingCompleteParams> Type =
|
||||
EventType<ScriptingCompleteParams>.Create("scripting/scriptComplete");
|
||||
}
|
||||
}
|
||||
@@ -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.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for all scripting event parameters.
|
||||
/// </summary>
|
||||
public abstract class ScriptingEventParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the operation id of the scripting operation this event is associated with.
|
||||
/// </summary>
|
||||
public string OperationId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters sent when a list objects operation has completed.
|
||||
/// </summary>
|
||||
public class ScriptingListObjectsCompleteParams : ScriptingCompleteParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the list of database objects returned from the list objects operation.
|
||||
/// </summary>
|
||||
public List<ScriptingObject> DatabaseObjects { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the count of database object returned from the list objects operation.
|
||||
/// </summary>
|
||||
public int Count { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event sent to indicate a list objects operation has completed.
|
||||
/// </summary>
|
||||
public class ScriptingListObjectsCompleteEvent
|
||||
{
|
||||
public static readonly EventType<ScriptingListObjectsCompleteParams> Type =
|
||||
EventType<ScriptingListObjectsCompleteParams>.Create("scripting/listObjectsComplete");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for a list objects request.
|
||||
/// </summary>
|
||||
public class ScriptingListObjectsParams
|
||||
{
|
||||
public string ConnectionString { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameters returned from a list objects request.
|
||||
/// </summary>
|
||||
public class ScriptingListObjectsResult
|
||||
{
|
||||
public string OperationId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the scripting list objects request type.
|
||||
/// </summary>
|
||||
public class ScriptingListObjectsRequest
|
||||
{
|
||||
public static readonly RequestType<ScriptingListObjectsParams, ScriptingListObjectsResult> Type =
|
||||
RequestType<ScriptingListObjectsParams, ScriptingListObjectsResult>.Create("scripting/listObjects");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Class to represent a database object that can be scripted.
|
||||
/// </summary>
|
||||
public sealed class ScriptingObject : IEquatable<ScriptingObject>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the database object type.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This underlying values are determined by the SqlScriptPublishModel.GetDatabaseObjectTypes() and
|
||||
/// can change depending on the version of SMO used by the tools service. Values can be:
|
||||
/// Table,
|
||||
/// View,
|
||||
/// StoredProcedure,
|
||||
/// UserDefinedFunction,
|
||||
/// UserDefinedDataType,
|
||||
/// User,
|
||||
/// Default,
|
||||
/// Rule,
|
||||
/// DatabaseRole,
|
||||
/// ApplicationRole,
|
||||
/// SqlAssembly,
|
||||
/// DdlTrigger,
|
||||
/// Synonym,
|
||||
/// XmlSchemaCollection,
|
||||
/// Schema,
|
||||
/// PlanGuide,
|
||||
/// UserDefinedType,
|
||||
/// UserDefinedAggregate,
|
||||
/// FullTextCatalog,
|
||||
/// UserDefinedTableType
|
||||
/// </remarks>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the schema of the database object.
|
||||
/// </summary>
|
||||
public string Schema { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the database object name.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string objectName = string.IsNullOrEmpty(this.Schema)
|
||||
? this.Name
|
||||
: this.Schema + "." + this.Name;
|
||||
|
||||
return objectName;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return
|
||||
StringComparer.OrdinalIgnoreCase.GetHashCode(this.Type ?? string.Empty) ^
|
||||
StringComparer.OrdinalIgnoreCase.GetHashCode(this.Schema ?? string.Empty) ^
|
||||
StringComparer.OrdinalIgnoreCase.GetHashCode(this.Name ?? string.Empty);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return
|
||||
obj != null &&
|
||||
this.GetType() == obj.GetType() &&
|
||||
this.Equals((ScriptingObject)obj);
|
||||
}
|
||||
|
||||
public bool Equals(ScriptingObject other)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return
|
||||
string.Equals(this.Type, other.Type, StringComparison.OrdinalIgnoreCase) &&
|
||||
string.Equals(this.Schema, other.Schema, StringComparison.OrdinalIgnoreCase) &&
|
||||
string.Equals(this.Name, other.Name, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
//
|
||||
// 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.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the scripting options.
|
||||
/// </summary>
|
||||
public class ScriptOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Generate ANSI padding statements
|
||||
/// </summary>
|
||||
public bool? ScriptAnsiPadding { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Append the generated script to a file
|
||||
/// </summary>
|
||||
public bool? AppendToFile { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Continue to script if an error occurs. Otherwise, stop.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default is true.
|
||||
/// </remarks>
|
||||
public bool? ContinueScriptingOnError { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Convert user-defined data types to base types.
|
||||
/// </summary>
|
||||
public bool? ConvertUDDTToBaseType { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Generate script for dependent objects for each object scripted.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default is false.
|
||||
/// </remarks>
|
||||
public bool? GenerateScriptForDependentObjects { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Include descriptive headers for each object generated.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default is true.
|
||||
/// </remarks>
|
||||
public bool? IncludeDescriptiveHeaders { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Check that an object with the given name exists before dropping or altering or that an object with the given name does not exist before creating.
|
||||
/// </summary>
|
||||
public bool? IncludeIfNotExists { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script options to set vardecimal storage format.
|
||||
/// </summary>
|
||||
public bool? IncludeVarDecimal { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Include system generated constraint names to enforce declarative referential integrity.
|
||||
/// </summary>
|
||||
public bool? ScriptDriIncludeSystemNames { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Include statements in the script that are not supported on the specified SQL Server database engine type.
|
||||
/// </summary>
|
||||
public bool? IncludeUnsupportedStatements { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Prefix object names with the object schema.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default is true.
|
||||
/// </remarks>
|
||||
public bool? SchemaQualify { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Script options to set bindings option.
|
||||
/// </summary>
|
||||
public bool? Bindings { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script the objects that use collation.
|
||||
/// </summary>
|
||||
public bool? Collation { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script the default values.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default is true.
|
||||
/// </remarks>
|
||||
public bool? Default { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Script Object CREATE/DROP statements.
|
||||
/// Possible values:
|
||||
/// ScriptCreate
|
||||
/// ScriptDrop
|
||||
/// ScriptCreateDrop
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default is ScriptCreate.
|
||||
/// </remarks>
|
||||
public string ScriptCreateDrop { get; set; } = "ScriptCreate";
|
||||
|
||||
/// <summary>
|
||||
/// Script the Extended Properties for each object scripted.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default is true.
|
||||
/// </remarks>
|
||||
public bool? ScriptExtendedProperties { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Script only features compatible with the specified version of SQL Server. Possible values:
|
||||
/// Script90Compat
|
||||
/// Script100Compat
|
||||
/// Script105Compat
|
||||
/// Script110Compat
|
||||
/// Script120Compat
|
||||
/// Script130Compat
|
||||
/// Script140Compat
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default is Script140Compat.
|
||||
/// </remarks>
|
||||
public string ScriptCompatibilityOption { get; set; } = "Script140Compat";
|
||||
|
||||
/// <summary>
|
||||
/// Script only features compatible with the specified SQL Server database engine edition.
|
||||
/// Possible Values:
|
||||
/// SqlServerPersonalEdition
|
||||
/// SqlServerStandardEdition
|
||||
/// SqlServerEnterpriseEdition
|
||||
/// SqlServerExpressEdition
|
||||
/// SqlAzureDatabaseEdition
|
||||
/// SqlDatawarehouseEdition
|
||||
/// SqlServerStretchEdition
|
||||
/// </summary>
|
||||
public string TargetDatabaseEngineEdition { get; set; } = "SqlServerEnterpriseEdition";
|
||||
|
||||
/// <summary>
|
||||
/// Script only features compatible with the specified SQL Server database engine type.
|
||||
/// Possible Values:
|
||||
/// SingleInstance
|
||||
/// SqlAzure
|
||||
/// </summary>
|
||||
public string TargetDatabaseEngineType { get; set; } = "SingleInstance";
|
||||
|
||||
/// <summary>
|
||||
/// Script all logins available on the server. Passwords will not be scripted.
|
||||
/// </summary>
|
||||
public bool? ScriptLogins { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Generate object-level permissions.
|
||||
/// </summary>
|
||||
public bool? ScriptObjectLevelPermissions { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script owner for the objects.
|
||||
/// </summary>
|
||||
public bool? ScriptOwner { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script statistics, and optionally include histograms, for each selected table or view.
|
||||
/// Possible values:
|
||||
/// ScriptStatsNone
|
||||
/// ScriptStatsDDL
|
||||
/// ScriptStatsAll
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is ScriptStatsNone.
|
||||
/// </remarks>
|
||||
public string ScriptStatistics { get; set; } = "ScriptStatsNone";
|
||||
|
||||
/// <summary>
|
||||
/// Generate USE DATABASE statement.
|
||||
/// </summary>
|
||||
public bool? ScriptUseDatabase { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Generate script that contains schema only or schema and data.
|
||||
/// Possible Values:
|
||||
/// SchemaAndData
|
||||
/// DataOnly
|
||||
/// SchemaOnly
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is SchemaOnly.
|
||||
/// </remarks>
|
||||
public string TypeOfDataToScript { get; set; } = "SchemaOnly";
|
||||
|
||||
/// <summary>
|
||||
/// Scripts the change tracking information.
|
||||
/// </summary>
|
||||
public bool? ScriptChangeTracking { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script the check constraints for each table or view scripted.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is true.
|
||||
/// </remarks>
|
||||
public bool? ScriptCheckConstraints { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Scripts the data compression information.
|
||||
/// </summary>
|
||||
public bool? ScriptDataCompressionOptions { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script the foreign keys for each table scripted.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is true.
|
||||
/// </remarks>
|
||||
public bool? ScriptForeignKeys { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Script the full-text indexes for each table or indexed view scripted.
|
||||
/// </summary>
|
||||
public bool? ScriptFullTextIndexes { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script the indexes (including XML and clustered indexes) for each table or indexed view scripted.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is true.
|
||||
/// </remarks>
|
||||
public bool? ScriptIndexes { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Script the primary keys for each table or view scripted
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is true.
|
||||
/// </remarks>
|
||||
public bool? ScriptPrimaryKeys { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Script the triggers for each table or view scripted
|
||||
/// </summary>
|
||||
public bool? ScriptTriggers { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Script the unique keys for each table or view scripted.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is true.
|
||||
/// </remarks>
|
||||
public bool? UniqueKeys { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters to indicate the script operation has resolved the objects to be scripted.
|
||||
/// </summary>
|
||||
public class ScriptingPlanNotificationParams : ScriptingEventParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the list of database objects whose progress has changed.
|
||||
/// </summary>
|
||||
public List<ScriptingObject> ScriptingObjects { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the count of database objects whose progress has changed.
|
||||
/// </summary>
|
||||
public int Count { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event sent to indicate a script operation has determined which objects will be scripted.
|
||||
/// </summary>
|
||||
public class ScriptingPlanNotificationEvent
|
||||
{
|
||||
public static readonly EventType<ScriptingPlanNotificationParams> Type = EventType<ScriptingPlanNotificationParams>.Create("scripting/scriptPlanNotification");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// 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.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters sent when a scripting operation has made progress.
|
||||
/// </summary>
|
||||
public class ScriptingProgressNotificationParams : ScriptingEventParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the scripting object whose progress has changed.
|
||||
/// </summary>
|
||||
public ScriptingObject ScriptingObject { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the status of the scripting operation for the scripting object.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Values can be: 'Completed', 'Progress', and 'Error'.
|
||||
/// </remarks>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or count of completed scripting operations.
|
||||
/// </summary>
|
||||
public int CompletedCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets this total count of objects to script.
|
||||
/// </summary>
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the error details if an error occurred scripting a database object.
|
||||
/// </summary>
|
||||
public string ErrorDetails { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event to indicate the scripting operation has made progress.
|
||||
/// </summary>
|
||||
public class ScriptingProgressNotificationEvent
|
||||
{
|
||||
public static readonly EventType<ScriptingProgressNotificationParams> Type =
|
||||
EventType<ScriptingProgressNotificationParams>.Create("scripting/scriptProgressNotification");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for a script request.
|
||||
/// </summary>
|
||||
public class ScriptingParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the file path used when writing out the script.
|
||||
/// </summary>
|
||||
public string FilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets connection string of the target database the scripting operation will run against.
|
||||
/// </summary>
|
||||
public string ConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of scripting objects to script.
|
||||
/// </summary>
|
||||
public List<ScriptingObject> ScriptingObjects { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of scripting object which specify the include criteria of objects to script.
|
||||
/// </summary>
|
||||
public List<ScriptingObject> IncludeObjectCriteria { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of scripting object which specify the exclude criteria of objects to not script.
|
||||
/// </summary>
|
||||
public List<ScriptingObject> ExcludeObjectCriteria { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the scripting options.
|
||||
/// </summary>
|
||||
public ScriptOptions ScriptOptions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameters returned from a script request.
|
||||
/// </summary>
|
||||
public class ScriptingResult
|
||||
{
|
||||
public string OperationId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the scripting request type.
|
||||
/// </summary>
|
||||
public class ScriptingRequest
|
||||
{
|
||||
public static readonly RequestType<ScriptingParams, ScriptingResult> Type =
|
||||
RequestType<ScriptingParams, ScriptingResult>.Create("scripting/script");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user