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, SqlConnection connection, FilePath sqlFile)
Examples
#addin "nuget:?package=Cake.SqlServer"
Task("Sql-Operations")
.Does(() =>
{
using (var connection = OpenSqlConnection(@"Data Source=(localdb)\MSSqlLocalDb;Initial Catalog=MyDatabase"))
{
ExecuteSqlFile(connection, "./somePath/MyScript.sql");
ExecuteSqlFile(connection, "./somePath/MyOtherScript.sql");
}
});
Attributes
Type |
Description |
CakeMethodAliasAttribute |
|
Parameters
Name |
Type |
Description |
context |
ICakeContext |
The Cake context. |
connection |
SqlConnection |
The connection to use. The connection must be open. See Cake.SqlServer.SqlServerAliases.OpenSqlConnection(Cake.Core.ICakeContext,System.String) . |
sqlFile |
FilePath |
Path to a file with SQL commands. |
Return Value