DacAliases.

RestoreBacpac(ICakeContext, string, string, FilePath) Method

Summary

Restores a bacpac file into a database.

NB: there must be no database with the name you provide. Otherwise exception will be thrown.

Assembly
Cake.SqlServer.dll
Namespace
Cake.SqlServer
Containing Type
DacAliases

Syntax

public static void RestoreBacpac(this ICakeContext context, string connectionString, string databaseName, FilePath bacpacFilePath)

Examples

    #addin "nuget:?package=Cake.SqlServer"

    Task("Create-Bacpac")
    	.Does(() =>{
    		var connString = @"data source=(localdb)\MSSqlLocalDb";
    
    		var dbName = "FromBacpac";
    
    		var file = new FilePath(@".\src\Tests\TestData\Nsaga.bacpac");
    
    		RestoreBacpac(connString, dbName, file);
    	});
    });        

Attributes

Type Description
CakeMethodAliasAttribute

Parameters

Name Type Description
context ICakeContext The Cake context.
connectionString string The connection string. You may want to connect to master database for this operation.
databaseName string Name of a new database you are creating
bacpacFilePath FilePath Full path to the bacpac file

Return Value

Type Description
void