Class CreateDatabaseTask
Will create a database if the database doesn't exists. In MySql or MariaDb, this will create a schema.
Implements
Inherited Members
Namespace: ETLBox.ControlFlow
Assembly: ETLBox.dll
Syntax
public sealed class CreateDatabaseTask : ControlFlowTask, ILoggableTask
Examples
CreateDatabaseTask.Create("DemoDB");
Constructors
CreateDatabaseTask()
Declaration
public CreateDatabaseTask()
Examples
CreateDatabaseTask.Create("DemoDB");
CreateDatabaseTask(string, string)
Declaration
public CreateDatabaseTask(string databaseName, string collation)
Parameters
Type | Name | Description |
---|---|---|
string | databaseName | |
string | collation |
Examples
CreateDatabaseTask.Create("DemoDB");
CreateDatabaseTask(string)
Declaration
public CreateDatabaseTask(string databaseName)
Parameters
Type | Name | Description |
---|---|---|
string | databaseName |
Examples
CreateDatabaseTask.Create("DemoDB");
Properties
Collation
The default collation for the database
Declaration
public string Collation { get; set; }
Property Value
Type | Description |
---|---|
string |
ObjectName
The name of the database (In MySql: The schema name)
Declaration
public string ObjectName { get; set; }
Property Value
Type | Description |
---|---|
string |
ON
Declaration
public ObjectNameDescriptor ON { get; }
Property Value
Type | Description |
---|---|
ObjectNameDescriptor |
Examples
CreateDatabaseTask.Create("DemoDB");
RecoveryModel
Sql Server only: The recovery model of the database
Declaration
public RecoveryModel RecoveryModel { get; set; }
Property Value
Type | Description |
---|---|
RecoveryModel |
Sql
The sql code that is used to generate the database
Declaration
public string Sql { get; }
Property Value
Type | Description |
---|---|
string |
TaskName
A name to identify the task or component. Every component or task comes with a default name that can be overwritten.
Declaration
public override string TaskName { get; set; }
Property Value
Type | Description |
---|---|
string |
Overrides
Methods
Create()
Runs the sql code to create the database. Throws an exception if the database already exists.
Declaration
public void Create()
Create(IConnectionManager, string, string)
Creates a database. In MySql or MariaDb, this will create a schema. Will throw an exception if the database already exists.
Declaration
public static void Create(IConnectionManager connectionManager, string databaseName, string collation)
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the server you want to connect. Make sure this points to a database that does exist (e.g. a system database) |
string | databaseName | The name of the database |
string | collation | The default collation of the database. |
Create(IConnectionManager, string)
Creates a database. In MySql or MariaDb, this will create a schema. Will throw an exception if the database already exists.
Declaration
public static void Create(IConnectionManager connectionManager, string databaseName)
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the server you want to connect. Make sure this points to a database that does exist (e.g. a system database) |
string | databaseName | The name of the database |
Create(string, string)
Creates a database. In MySql or MariaDb, this will create a schema. Will throw an exception if the database already exists. Make sure that your default connection string points to the server itself and to an existing database (e.g. a system database).
Declaration
public static void Create(string databaseName, string collation)
Parameters
Type | Name | Description |
---|---|---|
string | databaseName | The name of the database |
string | collation | The default collation of the database. |
Create(string)
Creates a database. In MySql or MariaDb, this will create a schema. Will throw an exception if the database already exists. Make sure that your default connection string points to the server itself and to an existing database (e.g. a system database).
Declaration
public static void Create(string databaseName)
Parameters
Type | Name | Description |
---|---|---|
string | databaseName | The name of the database |
CreateIfNotExists()
Runs the sql code to create the database if the database doesn't exist yet.
Declaration
public void CreateIfNotExists()
CreateIfNotExists(IConnectionManager, string, string)
Creates a database if the database doesn't exists. In MySql or MariaDb, this will create a schema.
Declaration
public static void CreateIfNotExists(IConnectionManager connectionManager, string databaseName, string collation)
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the server you want to connect. Make sure this points to a database that does exist (e.g. a system database) |
string | databaseName | The name of the database |
string | collation | The default collation of the database. |
CreateIfNotExists(IConnectionManager, string)
Creates a database if the database doesn't exists. In MySql or MariaDb, this will create a schema.
Declaration
public static void CreateIfNotExists(IConnectionManager connectionManager, string databaseName)
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | The connection manager of the server you want to connect. Make sure this points to a database that does exist (e.g. a system database) |
string | databaseName | The name of the database |
CreateIfNotExists(string, string)
Creates a database if the database doesn't exists. In MySql or MariaDb, this will create a schema. Make sure that your default connection string points to the server itself and to an existing database (e.g. a system database).
Declaration
public static void CreateIfNotExists(string databaseName, string collation)
Parameters
Type | Name | Description |
---|---|---|
string | databaseName | The name of the database |
string | collation | The default collation of the database. |
CreateIfNotExists(string)
Creates a database if the database doesn't exists. In MySql or MariaDb, this will create a schema. Make sure that your default connection string points to the server itself and to an existing database (e.g. a system database).
Declaration
public static void CreateIfNotExists(string databaseName)
Parameters
Type | Name | Description |
---|---|---|
string | databaseName | The name of the database |