DacServices.ImportBacpac Method (BacPackage, String, DacImportOptions, Nullable<CancellationToken>)

Deploy schema and import table data from the supplied package to a database.

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

Syntax

'Declaration
Public Sub ImportBacpac ( _
    package As BacPackage, _
    targetDatabaseName As String, _
    importOptions As DacImportOptions, _
    cancellationToken As Nullable(Of CancellationToken) _
)
'Usage
Dim instance As DacServices 
Dim package As BacPackage 
Dim targetDatabaseName As String 
Dim importOptions As DacImportOptions 
Dim cancellationToken As Nullable(Of CancellationToken)

instance.ImportBacpac(package, targetDatabaseName, _
    importOptions, cancellationToken)
public void ImportBacpac(
    BacPackage package,
    string targetDatabaseName,
    DacImportOptions importOptions,
    Nullable<CancellationToken> cancellationToken
)
public:
void ImportBacpac(
    BacPackage^ package, 
    String^ targetDatabaseName, 
    DacImportOptions^ importOptions, 
    Nullable<CancellationToken> cancellationToken
)
member ImportBacpac : 
        package:BacPackage * 
        targetDatabaseName:string * 
        importOptions:DacImportOptions * 
        cancellationToken:Nullable<CancellationToken> -> unit
public function ImportBacpac(
    package : BacPackage, 
    targetDatabaseName : String, 
    importOptions : DacImportOptions, 
    cancellationToken : Nullable<CancellationToken>
)

Parameters

  • targetDatabaseName
    Type: String
    Name of the target database for deployment.
  • 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 import.

OperationCanceledException

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

See Also

Reference

DacServices Class

ImportBacpac Overload

Microsoft.SqlServer.Dac Namespace