Class CreateDatabaseTask

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

Inheritance
object
CreateDatabaseTask
Implements
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
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
TypeNameDescription
stringdatabaseName
stringcollation
Examples
CreateDatabaseTask.Create("DemoDB");

CreateDatabaseTask(string)

Declaration
    public CreateDatabaseTask(string databaseName)
Parameters
TypeNameDescription
stringdatabaseName
Examples
CreateDatabaseTask.Create("DemoDB");

Properties

Collation

The default collation for the database

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

ObjectName

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

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

ON

Declaration
    public ObjectNameDescriptor ON { get; }
Property Value
TypeDescription
ObjectNameDescriptor
Examples
CreateDatabaseTask.Create("DemoDB");

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

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
TypeDescription
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
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(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(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.

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

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
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(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(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.

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

Implements