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
Contains functionality to deal with SQL Server: DropDatabase, CreateDatabase, execute SQL, execute SQL from files, etc. Provides functionality to manage LocalDb instances: Create, Start, Stop, Delete instances;
In order to use the commands for this addin, include the following in your build.cake file to download and reference from NuGet.org:
#addin "nuget:?package=Cake.SqlServer"
- Assembly
- Cake
.SqlServer .dll - Namespace
- Cake
.SqlServer - Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type["SqlServerAliases"]
class Type type-node
Syntax
public static class SqlServerAliases
Attributes
Type | Description |
---|---|
Cake |
Methods
Name | Value | Summary |
---|---|---|
CreateDatabase |
void |
Creates an empty database. If database with this name already exists, throws a SqlException.
Allows to specify primary and log files location.
static
|
CreateDatabase |
void |
Creates an empty database. If database with this name already exists, throws a SqlException.
Cake.SqlServer.SqlServerAliases.CreateDatabaseIfNotExists(Cake.Core.ICakeContext,System.String,System.String) if you would like to check if database already exists.
static
|
Create |
void |
Creates an empty database if another database with the same does not already exist.
static
|
Create |
void |
Creates an empty database if another database with the same does not already exist.
static
|
DatabaseExists |
bool |
Test if the database exists
static
|
Drop |
void |
First drops, then recreates the database
static
|
Drop |
void |
First drops, then recreates the database
static
|
DropDatabase |
void |
Drops database. Before dropping the DB, database is set to be offline, then online again.
This is to be sure that there are no live connections, otherwise the script will fail.
Also if the database does not exist - it will not do anything.
static
|
ExecuteSqlCommand |
void |
Execute any SQL command.
static
|
ExecuteSqlCommand |
void |
Execute any SQL command.
static
|
ExecuteSqlFile |
void |
Reads SQL commands from a file and executes them.
static
|
ExecuteSqlFile |
void |
Reads SQL commands from a file and executes them.
static
|
OpenSqlConnection |
SqlConnection |
Opens a new
Microsoft.Data.SqlClient.SqlConnection with the given connection string.
static
|
SetSqlCommandTimeout |
void |
Sets the CommandTimeout property for all SqlCommands used internally
static
|
Extension Methods
Name | Value | Summary |
---|---|---|
ToDictionary |
IDictionary |
From ObjectHelpers
Requires the Cake.DeployParams addin
|
To |
string |
Returns the string value or a
Not set > markup suitable for Spectre.Console.
From StringExtensions
Requires the Cake.Issues addin
|