DacServices.ExportBacpac Method (String, String, DacExportOptions, IEnumerable<Tuple<String, String>>, Nullable<CancellationToken>)
Extract schema and export data from a database into a "bacpac" package.
Namespace: Microsoft.SqlServer.Dac
Assembly: Microsoft.SqlServer.Dac (in Microsoft.SqlServer.Dac.dll)
Syntax
'Declaration
Public Sub ExportBacpac ( _
packageFileName As String, _
databaseName As String, _
options As DacExportOptions, _
tables As IEnumerable(Of Tuple(Of String, String)), _
cancellationToken As Nullable(Of CancellationToken) _
)
'Usage
Dim instance As DacServices
Dim packageFileName As String
Dim databaseName As String
Dim options As DacExportOptions
Dim tables As IEnumerable(Of Tuple(Of String, String))
Dim cancellationToken As Nullable(Of CancellationToken)
instance.ExportBacpac(packageFileName, _
databaseName, options, tables, cancellationToken)
public void ExportBacpac(
string packageFileName,
string databaseName,
DacExportOptions options,
IEnumerable<Tuple<string, string>> tables,
Nullable<CancellationToken> cancellationToken
)
public:
void ExportBacpac(
String^ packageFileName,
String^ databaseName,
DacExportOptions^ options,
IEnumerable<Tuple<String^, String^>^>^ tables,
Nullable<CancellationToken> cancellationToken
)
member ExportBacpac :
packageFileName:string *
databaseName:string *
options:DacExportOptions *
tables:IEnumerable<Tuple<string, string>> *
cancellationToken:Nullable<CancellationToken> -> unit
public function ExportBacpac(
packageFileName : String,
databaseName : String,
options : DacExportOptions,
tables : IEnumerable<Tuple<String, String>>,
cancellationToken : Nullable<CancellationToken>
)
Parameters
- packageFileName
Type: String
Path of the target package file.
- databaseName
Type: String
Name of the source database.
- options
Type: Microsoft.SqlServer.Dac.DacExportOptions
Instance of DacExportOptions that specifies properties that affect various aspects of the export.
- tables
Type: IEnumerable<Tuple<String, String>>
Optional enumerable used to retrieve enumerator over set of tables for which data should be exported. For each Tuple in the enumeration the first item specifies the schema of the table, and the second specifies the base identifier of the table.
- cancellationToken
Type: 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.
Exceptions
Exception | Condition |
---|---|
ArgumentException | If the value for any of the required parameters is a null reference or an empty string. |
DacServicesException | If an error occurs during schema deployment and data export; or if options specifies a table that does not exist in the schema contained in the supplied package. |
OperationCanceledException | If the CancellationToken has a cancellation requested and the operation could be cancelled. |