Class SqlConnectionManager

Connection manager of a classic ADO.NET connection to a (Microsoft) Sql Server.

Inheritance
System.Object
DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>
SqlConnectionManager
Implements
IConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction>
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.SqlServer.dll
Syntax
    public class SqlConnectionManager : DbConnectionManager<SqlConnection, SqlTransaction, SqlParameter>, IConnectionManager<SqlConnection, SqlTransaction>, IConnectionManager, IDisposable
Examples
ControlFlow.DefaultDbConnection = new SqlConnectionManager(new ConnectionString("Data Source=.;"));

Constructors

SqlConnectionManager()

Declaration
    public SqlConnectionManager()

SqlConnectionManager(SqlConnectionString)

Declaration
    public SqlConnectionManager(SqlConnectionString connectionString)
Parameters
TypeNameDescription
SqlConnectionStringconnectionString

SqlConnectionManager(String)

Declaration
    public SqlConnectionManager(string connectionString)
Parameters
TypeNameDescription
System.StringconnectionString

Properties

AccessToken

If you provide an access token here, this token will be used for authentication with Sql Server

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

ConnectionManagerType

The database type for the connection manager.

Declaration
    public override ConnectionManagerType ConnectionManagerType { get; protected set; }
Property Value
TypeDescription
ConnectionManagerType
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.ConnectionManagerType

DisableCheckConstraints

If set to true, foreign key constraints will ot be checked when doing the bulk insert. By default, foreign key constraints are checked. To improve bulk insert performance, you can disable foreign key constrain checks.

Declaration
    public bool DisableCheckConstraints { get; set; }
Property Value
TypeDescription
System.Boolean

DisableTriggers

If set to true, triggers will not be fired when doing the bulk insert. By default, all triggers are fired in bulk insert operations.

Declaration
    public bool DisableTriggers { get; set; }
Property Value
TypeDescription
System.Boolean

MaxParameterAmount

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

Declaration
    public override int MaxParameterAmount { get; }
Property Value
TypeDescription
System.Int32
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.MaxParameterAmount

ModifyDBSettings

Will set the database settings SET PAGE_VERIFY NONE and SET RECOVERY BULK_LOGGED Settings will be reverted after the bulk insert operation.

Declaration
    public bool ModifyDBSettings { get; set; }
Property Value
TypeDescription
System.Boolean

QB

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

Declaration
    public override string QB { get; protected set; }
Property Value
TypeDescription
System.String
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.QB

QE

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

Declaration
    public override string QE { get; protected set; }
Property Value
TypeDescription
System.String
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.QE

Methods

BulkDelete(ITableData)

Performs a bulk delete

Declaration
    public override void BulkDelete(ITableData data)
Parameters
TypeNameDescription
ITableDatadata

Batch of data

Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.BulkDelete(ETLBox.ControlFlow.ITableData)

BulkInsert(ITableData)

Performs a bulk insert

Declaration
    public override void BulkInsert(ITableData data)
Parameters
TypeNameDescription
ITableDatadata

Batch of data

Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.BulkInsert(ETLBox.ControlFlow.ITableData)

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

Declaration
    public override void BulkSelect(ITableData data, ICollection<string> selectColumnNames, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] rowActions)
Parameters
TypeNameDescription
ITableDatadata
System.Collections.Generic.ICollection<System.String>selectColumnNames
System.ActionbeforeRowReadAction
System.ActionafterRowReadAction
System.Action<System.Object>[]rowActions
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.BulkSelect(ETLBox.ControlFlow.ITableData, System.Collections.Generic.ICollection<System.String>, System.Action, System.Action, System.Action<System.Object>[])

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

Performs a bulk update

Declaration
    public override void BulkUpdate(ITableData data, ICollection<string> setColumnNames, ICollection<string> joinColumnNames)
Parameters
TypeNameDescription
ITableDatadata

Batch of data

System.Collections.Generic.ICollection<System.String>setColumnNames
System.Collections.Generic.ICollection<System.String>joinColumnNames
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.BulkUpdate(ETLBox.ControlFlow.ITableData, System.Collections.Generic.ICollection<System.String>, System.Collections.Generic.ICollection<System.String>)

CleanUpBulkInsert(String)

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

Declaration
    public override void CleanUpBulkInsert(string tablename)
Parameters
TypeNameDescription
System.Stringtablename
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.CleanUpBulkInsert(System.String)

Clone()

Cretes a clone of the current connection manager

Declaration
    public override IConnectionManager Clone()
Returns
TypeDescription
IConnectionManager

A instance copy of the current connection manager

Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.Clone()

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 override void CreateDbConnection()
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.CreateDbConnection()

PrepareBulkInsert(String)

Performs preparations needed to improved performance of a bulk insert operation

Declaration
    public override void PrepareBulkInsert(string tablename)
Parameters
TypeNameDescription
System.Stringtablename
Overrides
ETLBox.Connection.DbConnectionManager<Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient.SqlTransaction, Microsoft.Data.SqlClient.SqlParameter>.PrepareBulkInsert(System.String)

Implements

System.IDisposable