共用方式為


DacServices.GenerateDeployScript Method

Definition

Overloads

GenerateDeployScript(DacPackage, DacPackage, String, DacDeployOptions)

Create T-SQL script that can be used to deploy the differences between the schemas of the supplied source and target DacPackage instances to a database.

GenerateDeployScript(DacPackage, String, DacDeployOptions, Nullable<CancellationToken>)

Create T-SQL script that can be used to deploy the schema of the supplied DacPackage to a database.

GenerateDeployScript(Stream, DacPackage, DacPackage, String, DacDeployOptions)

Create T-SQL script that can be used to deploy the differences between the schemas of the supplied source and target DacPackage instances to a database.

GenerateDeployScript(DacPackage, DacPackage, String, DacDeployOptions)

Create T-SQL script that can be used to deploy the differences between the schemas of the supplied source and target DacPackage instances to a database.

public static string GenerateDeployScript (Microsoft.SqlServer.Dac.DacPackage sourcePackage, Microsoft.SqlServer.Dac.DacPackage targetPackage, string targetDatabaseName, Microsoft.SqlServer.Dac.DacDeployOptions options = default);
static member GenerateDeployScript : Microsoft.SqlServer.Dac.DacPackage * Microsoft.SqlServer.Dac.DacPackage * string * Microsoft.SqlServer.Dac.DacDeployOptions -> string
Public Shared Function GenerateDeployScript (sourcePackage As DacPackage, targetPackage As DacPackage, targetDatabaseName As String, Optional options As DacDeployOptions = Nothing) As String

Parameters

sourcePackage
DacPackage

DacPackage containing the source schema to be compared.

targetPackage
DacPackage

DacPackage containing the target schema to be compared.

targetDatabaseName
String

Name of the target database for deployment.

options
DacDeployOptions

Instance of DacDeployOptions that specifies properties that affect various aspects of the deployment script creation.

Returns

String of T-SQL script used to create or update database schema based on the supplied DacPackage.

Exceptions

If a problem occurs during script generation.

Applies to

GenerateDeployScript(DacPackage, String, DacDeployOptions, Nullable<CancellationToken>)

Create T-SQL script that can be used to deploy the schema of the supplied DacPackage to a database.

public string GenerateDeployScript (Microsoft.SqlServer.Dac.DacPackage package, string targetDatabaseName, Microsoft.SqlServer.Dac.DacDeployOptions options = default, System.Threading.CancellationToken? cancellationToken = default);
member this.GenerateDeployScript : Microsoft.SqlServer.Dac.DacPackage * string * Microsoft.SqlServer.Dac.DacDeployOptions * Nullable<System.Threading.CancellationToken> -> string
Public Function GenerateDeployScript (package As DacPackage, targetDatabaseName As String, Optional options As DacDeployOptions = Nothing, Optional cancellationToken As Nullable(Of CancellationToken) = Nothing) As String

Parameters

package
DacPackage

DacPackage containing schema to be deployed.

targetDatabaseName
String

Name of the target database for deployment.

options
DacDeployOptions

Instance of DacDeployOptions that specifies properties that affect various aspects of the deployment script creation.

cancellationToken
Nullable<CancellationToken>

Optional CancellationToken that can be used to indicate that the operation should be cancelled. Use of this object does not guarantee that the operation will be cancelled.

Returns

String of T-SQL script used to create or update database schema based on the supplied DacPackage.

Exceptions

If a problem occurs during script generation.

If the CancellationToken has a cancellation requested and the operation could be cancelled.

Applies to

GenerateDeployScript(Stream, DacPackage, DacPackage, String, DacDeployOptions)

Create T-SQL script that can be used to deploy the differences between the schemas of the supplied source and target DacPackage instances to a database.

public static void GenerateDeployScript (System.IO.Stream outputStream, Microsoft.SqlServer.Dac.DacPackage sourcePackage, Microsoft.SqlServer.Dac.DacPackage targetPackage, string targetDatabaseName, Microsoft.SqlServer.Dac.DacDeployOptions options = default);
static member GenerateDeployScript : System.IO.Stream * Microsoft.SqlServer.Dac.DacPackage * Microsoft.SqlServer.Dac.DacPackage * string * Microsoft.SqlServer.Dac.DacDeployOptions -> unit
Public Shared Sub GenerateDeployScript (outputStream As Stream, sourcePackage As DacPackage, targetPackage As DacPackage, targetDatabaseName As String, Optional options As DacDeployOptions = Nothing)

Parameters

outputStream
Stream

Stream to which to write the deployment script.

sourcePackage
DacPackage

DacPackage containing the source schema to be compared.

targetPackage
DacPackage

DacPackage containing the target schema to be compared.

targetDatabaseName
String

Name of the target database for deployment.

options
DacDeployOptions

Instance of DacDeployOptions that specifies properties that affect various aspects of the deployment script creation.

Exceptions

If a problem occurs during script generation.

Applies to