Class CreateDatabaseTask

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

Inheritance
System.Object
CreateDatabaseTask
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ETLBox.ControlFlow.Tasks
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
System.StringdatabaseName

CreateDatabaseTask(String, String)

Declaration
    public CreateDatabaseTask(string databaseName, string collation)
Parameters
TypeNameDescription
System.StringdatabaseName
System.Stringcollation

Properties

Collation

The default collation for the database

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

DatabaseName

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

Declaration
    public string DatabaseName { get; set; }
Property Value
TypeDescription
System.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
System.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
System.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)

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)

System.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)

System.StringdatabaseName

The name of the database

System.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
System.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
System.StringdatabaseName

The name of the database

System.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)

System.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)

System.StringdatabaseName

The name of the database

System.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
System.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
System.StringdatabaseName

The name of the database

System.Stringcollation

The default collation of the database.

Implements