DacServices.ExportBacpac Method (Stream, String, IEnumerable<Tuple<String, String>>, Nullable<CancellationToken>)

Extracts schema and exports data from a database into a "bacpac" package.

Namespace:  Microsoft.SqlServer.Dac
Assembly:  Microsoft.SqlServer.Dac (in Microsoft.SqlServer.Dac.dll)

public void ExportBacpac(
	Stream packageStream,
	string databaseName,
	IEnumerable<Tuple<string, string>> tables,
	Nullable<CancellationToken> cancellationToken


Type: Stream
The Stream to which to write the package.
Type: String
The name of the source database.
Type: IEnumerable<Tuple<String, String>>
The 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. If the value for this parameter is a null reference, data for all tables will be exported.
Type: Nullable<CancellationToken>
The 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.


If the value for any of the required parameters is a null reference or an empty string.


If an error occurs during schema deployment and data export; or if tables specifies a table that does not exist in the schema contained in the supplied package; or the supplied stream is not suitable for writing the package.


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

Community Additions