This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see
Cake.SqlServer.
Summary
Reads SQL commands from a file and executes them.
Syntax
public static void ExecuteSqlFile(this ICakeContext context, string connectionString, FilePath sqlFile)
Examples
#addin "nuget:?package=Cake.SqlServer"
Task("Sql-Operations")
.Does(() =>
{
var connectionString = @"Data Source=(localdb)\MSSqlLocalDb;Initial Catalog=MyDatabase";
var sqlFile = "./somePath/MyScript.sql";
ExecuteSqlCommand(connectionString, sqlFile);
});
Attributes
Type |
Description |
CakeMethodAliasAttribute |
|
Parameters
Name |
Type |
Description |
context |
ICakeContext |
The Cake context. |
connectionString |
string |
The connection string. You may want to specify Initial Catalog. If there are changing parameters, Microsoft.Data.SqlClient.SqlConnectionStringBuilder is recommended to escape input. |
sqlFile |
FilePath |
Path to a file with SQL commands. |
Return Value