• Getting started
  • API Documentation
  • Pricing
  • Contact
Show / Hide Table of Contents
  • ETLBox.Connection
    • AccessOdbcConnectionManager
    • AdomdConnectionManager
    • ConnectionManagerType
    • Db2ConnectionManager
    • Db2ConnectionString
    • DbConnectionManager<TConnection, TTransaction, TParameter>
    • DbConnectionString<T, TBuilder>
    • IConnectionManager
    • IConnectionManager<TConnection, TTransaction>
    • IConnectionManagerDbObjects
    • IDbConnectionString
    • MariaDbConnectionManager
    • MariaDbConnectionString
    • MySqlConnectionManager
    • MySqlConnectionString
    • MySqlOdbcConnectionManager
    • OdbcConnectionManager
    • OdbcConnectionString
    • OleDbConnectionManager
    • OleDbConnectionString
    • OracleConnectionManager
    • OracleConnectionString
    • OracleOdbcConnectionManager
    • PostgresConnectionManager
    • PostgresConnectionString
    • PostgresOdbcConnectionManager
    • SqlConnectionManager
    • SqlConnectionString
    • SQLiteConnectionManager
    • SQLiteConnectionString
    • SqlOdbcConnectionManager
    • SqlOleDbConnectionManager
  • ETLBox.ControlFlow
    • ControlFlow
    • ControlFlowTask
    • DbTask
    • DropTask<T>
    • IfExistsTask
    • ILoggableTask
    • ITableData
    • LoggableTask
    • ProcedureDefinition
    • ProcedureParameter
    • QueryParameter
    • TableColumn
    • TableData
    • TableDefinition
  • ETLBox.ControlFlow.Tasks
    • CleanUpSchemaTask
    • CreateDatabaseTask
    • CreateIndexTask
    • CreateProcedureTask
    • CreateSchemaTask
    • CreateTableTask
    • CreateViewTask
    • DropDatabaseTask
    • DropIndexTask
    • DropProcedureTask
    • DropSchemaTask
    • DropTableTask
    • DropViewTask
    • GetDatabaseListTask
    • GetListTask
    • GetTableListTask
    • GetViewListTask
    • IfDatabaseExistsTask
    • IfIndexExistsTask
    • IfProcedureExistsTask
    • IfSchemaExistsTask
    • IfTableOrViewExistsTask
    • RecoveryModel
    • RowCountOptions
    • RowCountTask
    • SqlTask
    • TruncateTableTask
    • XmlaTask
  • ETLBox.DataFlow
    • AggregateColumn
    • ChangeAction
    • ColumnMap
    • CompareColumn
    • DataFlow
    • DataFlowBatchDestination<TInput>
    • DataFlowComponent
    • DataFlowDestination<TInput>
    • DataFlowExecutableSource<TOutput>
    • DataFlowJoinTarget<TInput>
    • DataFlowSource<TOutput>
    • DataFlowStreamDestination<TInput>
    • DataFlowStreamSource<TOutput>
    • DataFlowTransformation<TInput, TOutput>
    • DeleteColumn
    • DistinctColumn
    • ErrorSource
    • ETLBoxError
    • ExcelColumn
    • ExcelRange
    • GenericTypeInfo
    • GroupColumn
    • ICacheManager<TInput, TCache>
    • IDataFlowBatchDestination
    • IDataFlowBatchDestination<TInput>
    • IDataFlowComponent
    • IDataFlowDestination
    • IDataFlowDestination<TInput>
    • IDataFlowExecutableSource
    • IDataFlowExecutableSource<TOutput>
    • IDataFlowLogging
    • IDataFlowSource
    • IDataFlowSource<TOutput>
    • IDataFlowStreamDestination
    • IDataFlowStreamDestination<TInput>
    • IDataFlowStreamSource
    • IDataFlowStreamSource<TOutput>
    • IDataFlowTransformation<TInput, TOutput>
    • IDataFlowTransformation<TOutput>
    • IdColumn
    • IMergeableRow
    • JoinTarget<TInput>
    • MatchColumn
    • MemoryCache<TInput, TCache>
    • MergeableRow
    • MergeMode
    • MergeProperties
    • Network
    • PropertyAttributes
    • RenameColumn
    • ResourceType
    • RetrieveColumn
    • StreamMetaData
    • TypeInfo
    • UpdateColumn
  • ETLBox.DataFlow.Connectors
    • ColumnConverter
    • ConcurrentMemoryDestination
    • ConcurrentMemoryDestination<TInput>
    • CsvDestination
    • CsvDestination<TInput>
    • CsvSource
    • CsvSource<TOutput>
    • CustomBatchDestination
    • CustomBatchDestination<TInput>
    • CustomBatchSource
    • CustomBatchSource<TOutput>
    • CustomDestination
    • CustomDestination<TInput>
    • CustomSource
    • CustomSource<TOutput>
    • DbDestination
    • DbDestination<TInput>
    • DbMerge
    • DbMerge<TInput>
    • DbSource
    • DbSource<TOutput>
    • ExcelSource
    • ExcelSource<TOutput>
    • JsonDestination
    • JsonDestination<TInput>
    • JsonSource
    • JsonSource<TOutput>
    • MemoryDestination
    • MemoryDestination<TInput>
    • MemorySource
    • MemorySource<TOutput>
    • TextDestination
    • TextDestination<TInput>
    • TextSource
    • TextSource<TOutput>
    • VoidDestination
    • VoidDestination<TInput>
    • XmlDestination
    • XmlDestination<TInput>
    • XmlSource
    • XmlSource<TOutput>
  • ETLBox.DataFlow.Transformations
    • Aggregation
    • Aggregation<TInput, TOutput>
    • AggregationMethod
    • BatchTransformation
    • BatchTransformation<TInput, TOutput>
    • BatchTransformation<TInput>
    • BlockTransformation
    • BlockTransformation<TInput, TOutput>
    • BlockTransformation<TInput>
    • CachedBatchTransformation
    • CachedBatchTransformation<TInput, TOutput, TCache>
    • CachedBatchTransformation<TInput, TOutput>
    • CachedBatchTransformation<TInput>
    • CachedRowTransformation
    • CachedRowTransformation<TInput, TOutput, TCache>
    • CachedRowTransformation<TInput, TOutput>
    • CachedRowTransformation<TInput>
    • CacheMode
    • ColumnRename
    • ColumnRename<TInput>
    • CrossJoin
    • CrossJoin<TInput>
    • CrossJoin<TInput1, TInput2, TOutput>
    • CrossJoin<TInput1, TInput2, TOutput>.InMemoryDestination<TInput>
    • Distinct<TInput>
    • LookupTransformation
    • LookupTransformation<TInput, TSource>
    • LookupTransformation<TInput, TSource>.PartialDbCacheSettings
    • MergeJoin
    • MergeJoin<TInput>
    • MergeJoin<TInput1, TInput2, TOutput>
    • Multicast
    • Multicast<TInput>
    • RowDuplication
    • RowDuplication<TInput>
    • RowMultiplication
    • RowMultiplication<TInput, TOutput>
    • RowMultiplication<TInput>
    • RowTransformation
    • RowTransformation<TInput, TOutput>
    • RowTransformation<TInput>
    • Sort
    • Sort<TInput>
    • XmlSchemaValidation
    • XmlSchemaValidation<TInput>
  • ETLBox.Exceptions
    • ETLBoxException
    • ETLBoxFaultedBufferException
    • ETLBoxNotSupportedException
  • ETLBox.Helper
    • BulkSqlGenerator<T>
    • DataTypeConverter
    • ExpandoJsonPathConverter
    • HashHelper
    • IDataTypeConverter
    • JsonPathConverter
    • JsonProperty2JsonPath
    • JsonProperty2JsonPath.MultipleResultsInPath
    • ListExtensions
    • ObjectNameDescriptor
    • PropertyInfoExtension
    • SqlParser
    • StringExtension
  • ETLBox.Logging
    • AbortLoadProcessTask
    • CreateErrorTableTask
    • CreateLoadProcessTableTask
    • CreateLogTableTask
    • CustomTask
    • EndLoadProcessTask
    • ETLLogLayoutRenderer
    • GetLoadProcessAsJSONTask
    • GetLogAsJSONTask
    • LoadProcess
    • LogEntry
    • Logging
    • LogHierarchyEntry
    • LogTask
    • Package
    • ReadLoadProcessTableTask
    • ReadLogTableTask
    • ReadOptions
    • Sequence
    • Sequence<T>
    • StartLoadProcessTask

Class DbConnectionManager<TConnection, TTransaction, TParameter>

The generic implementation on which all connection managers are based on

Inheritance
System.Object
DbConnectionManager<TConnection, TTransaction, TParameter>
AdomdConnectionManager
Db2ConnectionManager
MySqlConnectionManager
OdbcConnectionManager
OleDbConnectionManager
OracleConnectionManager
PostgresConnectionManager
SqlConnectionManager
SQLiteConnectionManager
Implements
IConnectionManager<TConnection, TTransaction>
IConnectionManager
System.IDisposable
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.Connection
Assembly: ETLBox.dll
Syntax
public abstract class DbConnectionManager<TConnection, TTransaction, TParameter> : IConnectionManager<TConnection, TTransaction>, IConnectionManager, IDisposable where TConnection : class, IDbConnection, new()
    where TTransaction : class, IDbTransaction where TParameter : class, IDbDataParameter, new()
Type Parameters
Name Description
TConnection

The underlying ADO.NET connection

TTransaction
TParameter

Constructors

DbConnectionManager()

Declaration
public DbConnectionManager()

DbConnectionManager(IDbConnectionString)

Declaration
public DbConnectionManager(IDbConnectionString connectionString)
Parameters
Type Name Description
IDbConnectionString connectionString

Properties

ConnectionManagerType

The database type for the connection manager.

Declaration
public abstract ConnectionManagerType ConnectionManagerType { get; protected set; }
Property Value
Type Description
ConnectionManagerType

ConnectionString

The connection string used to establish the connection with the database

Declaration
public IDbConnectionString ConnectionString { get; set; }
Property Value
Type Description
IDbConnectionString

DbConnection

The underlying ADO.NET connection. Only read from this object and it's properties - by default, connections are always acquired from the connection pool. There is no guarantee that the same connection will be used in ETLBox components.

Declaration
public TConnection DbConnection { get; protected set; }
Property Value
Type Description
TConnection

DisablePreparationForNextExecution

Declaration
protected bool DisablePreparationForNextExecution { get; set; }
Property Value
Type Description
System.Boolean

DoPrepareCommand

Declaration
public virtual bool DoPrepareCommand { get; set; }
Property Value
Type Description
System.Boolean

IsInBulkInsert

Indicates if the current connection is currently used in a bulk insert operation (e.g. performed by a DbDestination)

Declaration
public bool IsInBulkInsert { get; set; }
Property Value
Type Description
System.Boolean

IsOdbcOrOleDbConnection

Indicates if the current connection mangager is used as a OleDb or Odbc Connection.

Declaration
public virtual bool IsOdbcOrOleDbConnection { get; }
Property Value
Type Description
System.Boolean

LeaveOpen

By default, after every sql operation the underlying ADO.NET connection is closed and retured to the ADO.NET connection pool. (This is the recommended behavior) To keep the connection open and avoid having the connection returned to the pool, set this to true. A connnection will be left open when a bulk insert operation is executed or a transaction hase been openend and not yet commited or rolled back.

Declaration
public bool LeaveOpen { get; set; }
Property Value
Type Description
System.Boolean

MaxLoginAttempts

Number of attempts that the connection managers tries to connect before it decides that the database is not reachable.

Declaration
public int MaxLoginAttempts { get; set; }
Property Value
Type Description
System.Int32

MaxParameterAmount

returns the maximum amount of parameters that ca be passed into a sql query.

Declaration
public virtual int MaxParameterAmount { get; }
Property Value
Type Description
System.Int32

PP

The character that is used in front of parameter names in query to identify the parameter. All databases use the '@' character, except Oracle which uses ':'

Declaration
public virtual string PP { get; protected set; }
Property Value
Type Description
System.String

QB

The quotation begin character that is used in the database. E.g. SqlServer uses: '[' and Postgres: '"'

Declaration
public abstract string QB { get; protected set; }
Property Value
Type Description
System.String

QE

The quotation end character that is used in the database. E.g. SqlServer uses: ']' and Postgres: '"'

Declaration
public abstract string QE { get; protected set; }
Property Value
Type Description
System.String

State

The state of the underlying ADO.NET connection

Declaration
public ConnectionState? State { get; }
Property Value
Type Description
System.Nullable<System.Data.ConnectionState>

SupportDatabases

Indicates if database server does support multiple databases. A database in ETLBox means a schema in MySql.

Declaration
public virtual bool SupportDatabases { get; }
Property Value
Type Description
System.Boolean

SupportProcedures

Indicates if the database supports procedures

Declaration
public virtual bool SupportProcedures { get; }
Property Value
Type Description
System.Boolean

SupportSchemas

Indicates if the database supports schemas In MySql, this is false because the schema here is a database in ETLBox. Use SupportDatabases instead

Declaration
public virtual bool SupportSchemas { get; }
Property Value
Type Description
System.Boolean

Transaction

The current transaction. Use to start a transaction, and or to commit or rollback.

Declaration
public TTransaction Transaction { get; set; }
Property Value
Type Description
TTransaction

Methods

BeginTransaction()

Will start a transaction with the default isolation level. This will leave the underlying ADO.NET connection open until the transaction is committed or rolled back.

Declaration
public void BeginTransaction()

BeginTransaction(IsolationLevel)

Will start a transaction with the given isolation level (if supported by the target database) This will leave the underlying ADO.NET connection open until the transaction is committed or rolled back.

Declaration
public void BeginTransaction(IsolationLevel isolationLevel)
Parameters
Type Name Description
System.Data.IsolationLevel isolationLevel

The isolation level for the transaction

BulkDelete(ITableData)

Performs a bulk delete

Declaration
public abstract void BulkDelete(ITableData data)
Parameters
Type Name Description
ITableData data

Batch of data

BulkInsert(ITableData)

Performs a bulk insert

Declaration
public abstract void BulkInsert(ITableData data)
Parameters
Type Name Description
ITableData data

Batch of data

BulkNonQuery(String, IEnumerable<TParameter>)

Declaration
protected int BulkNonQuery(string commandText, IEnumerable<TParameter> parameterList)
Parameters
Type Name Description
System.String commandText
System.Collections.Generic.IEnumerable<TParameter> parameterList
Returns
Type Description
System.Int32

BulkReader(String, IEnumerable<TParameter>, Action, Action, Action<Object>[])

Declaration
protected void BulkReader(string commandText, IEnumerable<TParameter> parameterList, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] rowActions)
Parameters
Type Name Description
System.String commandText
System.Collections.Generic.IEnumerable<TParameter> parameterList
System.Action beforeRowReadAction
System.Action afterRowReadAction
System.Action<System.Object>[] rowActions

BulkSelect(ITableData, ICollection<String>, Action, Action, Action<Object>[])

Declaration
public virtual void BulkSelect(ITableData data, ICollection<string> selectColumnNames, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
Type Name Description
ITableData data
System.Collections.Generic.ICollection<System.String> selectColumnNames
System.Action beforeRowReadAction
System.Action afterRowReadAction
System.Action<System.Object>[] actions

BulkUpdate(ITableData, ICollection<String>, ICollection<String>)

Performs a bulk update

Declaration
public abstract void BulkUpdate(ITableData data, ICollection<string> setColumnNames, ICollection<string> joinColumnNames)
Parameters
Type Name Description
ITableData data

Batch of data

System.Collections.Generic.ICollection<System.String> setColumnNames
System.Collections.Generic.ICollection<System.String> joinColumnNames

CleanUpBulkInsert(String)

Called after the whole bulk insert operation to change back settings made to improve bulk insert performance

Declaration
public abstract void CleanUpBulkInsert(string tableName)
Parameters
Type Name Description
System.String tableName

Destination table name

Clone()

Cretes a clone of the current connection manager

Declaration
public abstract IConnectionManager Clone()
Returns
Type Description
IConnectionManager

A instance copy of the current connection manager

CloneIfAllowed()

Try to create a clone of the current connection - only possible if LeaveOpen is false.

Declaration
public IConnectionManager CloneIfAllowed()
Returns
Type Description
IConnectionManager

The connection that was either cloned or the current connection

Close()

Always closes the connection

Declaration
public void Close()

CloseIfAllowed()

Closes the connection if leave open is false and no transaction or bulk insert is in progress.

Declaration
public void CloseIfAllowed()

CommitTransaction()

Commits the current tranasction.

Declaration
public void CommitTransaction()

CopyBaseAttributes(DbConnectionManager<TConnection, TTransaction, TParameter>)

Declaration
public void CopyBaseAttributes(DbConnectionManager<TConnection, TTransaction, TParameter> original)
Parameters
Type Name Description
DbConnectionManager<TConnection, TTransaction, TParameter> original

CreateDbConnection()

By default, a db connection is created with the given connection string value. Override this method if you want to pass additional properties to the specific Ado.NET db connection.

Declaration
public virtual void CreateDbConnection()

Dispose()

Alyways closes the connection

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

ExecuteNonQuery(String, IEnumerable<QueryParameter>)

Executes a query against the database that doesn't return any data.

Declaration
public int ExecuteNonQuery(string commandText, IEnumerable<QueryParameter> parameterList = null)
Parameters
Type Name Description
System.String commandText
System.Collections.Generic.IEnumerable<QueryParameter> parameterList

The optional list of parameters

Returns
Type Description
System.Int32

Number of affected rows.

ExecuteReader(String, IEnumerable<QueryParameter>)

Executes a query against the database that does return multiple rows in multiple columns

Declaration
public IDataReader ExecuteReader(string commandText, IEnumerable<QueryParameter> parameterList = null)
Parameters
Type Name Description
System.String commandText
System.Collections.Generic.IEnumerable<QueryParameter> parameterList

The optional list of parameters

Returns
Type Description
System.Data.IDataReader

A data reader to iterate through the result set

ExecuteScalar(String, IEnumerable<QueryParameter>)

Executes a query against the database that does return only one row in one column.

Declaration
public object ExecuteScalar(string commandText, IEnumerable<QueryParameter> parameterList = null)
Parameters
Type Name Description
System.String commandText
System.Collections.Generic.IEnumerable<QueryParameter> parameterList

The optional list of parameters

Returns
Type Description
System.Object

The result

Open()

Opens the connection to the database. Normally you don't have to do this on your own, as all tasks and components will call this method implictly if the connection is closed. If the connection is already open, nothing is done.

Declaration
public void Open()

PrepareBulkInsert(String)

Performs preparations needed to improved performance of a bulk insert operation

Declaration
public abstract void PrepareBulkInsert(string tableName)
Parameters
Type Name Description
System.String tableName

Destination table name

RollbackTransaction()

Rolls the current transaction back.

Declaration
public void RollbackTransaction()

Implements

IConnectionManager<TConnection, TTransaction>
IConnectionManager
System.IDisposable
In This Article
Back to top Crafted with <3 in Berlin
Contact & legal notice