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
Sets the CommandTimeout property for all SqlCommands used internally
Syntax
public static void SetSqlCommandTimeout ( this ICakeContext context, int commandTimeout)
Examples
#addin "nuget:?package=Cake.SqlServer"
Task("Sql-Operations" )
.Does(() =>
{
SetSqlCommandTimeout(60 );
using (var connection = OpenSqlConnection(@"Data Source=(localdb)\MSSqlLocalDb;Initial Catalog=MyDatabase" ))
{
ExecuteSqlCommand(connection, "..." );
ExecuteSqlFile(connection, "./somePath/MyScript.sql" );
}
});
Attributes
Type
Description
CakeMethodAliasAttribute
Parameters
Name
Type
Description
context
ICakeContext
The Cake context.
commandTimeout
int
The time in seconds to wait for the command to execute. Used to set CommandTimeout property to when creating Microsoft.Data.SqlClient.SqlCommand
Return Value