CreateDatabaseTask

Class CreateDatabaseTask

Will create a database if the database doesn't exists. In MySql or MariaDb, this will create a schema.

Inheritance
CreateDatabaseTask
Implements
Namespace: ETLBox.ControlFlow
Assembly: ETLBox.dll
Syntax
    public sealed class CreateDatabaseTask : ControlFlowTask, ILoggableTask
Examples
CreateDatabaseTask.Create("DemoDB");

Constructors

CreateDatabaseTask()

Declaration
    public CreateDatabaseTask()

CreateDatabaseTask(string)

Declaration
    public CreateDatabaseTask(string databaseName)
Parameters
TypeNameDescription
stringdatabaseName

CreateDatabaseTask(string, string)

Declaration
    public CreateDatabaseTask(string databaseName, string collation)
Parameters
TypeNameDescription
stringdatabaseName
stringcollation

Properties

Collation

The default collation for the database

Declaration
    public string Collation { get; set; }
Property Value
TypeDescription
string

ON

Declaration
    public ObjectNameDescriptor ON { get; }
Property Value
TypeDescription
ObjectNameDescriptor

ObjectName

The name of the database (In MySql: The schema name)

Declaration
    public string ObjectName { get; set; }
Property Value
TypeDescription
string

RecoveryModel

Sql Server only: The recovery model of the database

Declaration
    public RecoveryModel RecoveryModel { get; set; }
Property Value
TypeDescription
RecoveryModel

Sql

The sql code that is used to generate the database

Declaration
    public string Sql { get; }
Property Value
TypeDescription
string

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)

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
TypeNameDescription
IConnectionManagerconnectionManager

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)

stringdatabaseName

The name of the database

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
TypeNameDescription
IConnectionManagerconnectionManager

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)

stringdatabaseName

The name of the database

stringcollation

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
TypeNameDescription
stringdatabaseName

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
TypeNameDescription
stringdatabaseName

The name of the database

stringcollation

The default collation 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)

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
TypeNameDescription
IConnectionManagerconnectionManager

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)

stringdatabaseName

The name of the database

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
TypeNameDescription
IConnectionManagerconnectionManager

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)

stringdatabaseName

The name of the database

stringcollation

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
TypeNameDescription
stringdatabaseName

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
TypeNameDescription
stringdatabaseName

The name of the database

stringcollation

The default collation of the database.

Implements