Class SqlConnectionManager
Connection manager of a classic ADO.NET connection to a (Microsoft) Sql Server.
Inheritance
Inherited Members
Namespace: ETLBox.Connection
Assembly: ETLBox.SqlServer.dll
Syntax
public class SqlConnectionManager : DbConnectionManager<SqlConnection>, IConnectionManager, IDisposable
Examples
ControlFlow.DefaultDbConnection = new SqlConnectionManager(new ConnectionString("Data Source=.;"));
Constructors
SqlConnectionManager()
Declaration
public SqlConnectionManager()
SqlConnectionManager(SqlConnectionString)
Declaration
public SqlConnectionManager(SqlConnectionString connectionString)
Parameters
Type | Name | Description |
---|---|---|
SqlConnectionString | connectionString |
SqlConnectionManager(String)
Declaration
public SqlConnectionManager(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString |
Properties
AccessToken
If you provide an access token here, this token will be used for authentification with Sql Server
Declaration
public string AccessToken { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ConnectionManagerType
The database type for the connection manager.
Declaration
public override ConnectionManagerType ConnectionManagerType { get; }
Property Value
Type | Description |
---|---|
ConnectionManagerType |
Overrides
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
Type | Description |
---|---|
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
Type | Description |
---|---|
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
Type | Description |
---|---|
System.Int32 |
Overrides
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
Type | Description |
---|---|
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; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
QE
The quotation end character that is used in the database. E.g. SqlServer uses: ']' and Postgres: '"'
Declaration
public override string QE { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
Methods
AfterBulkInsert(String)
Called after every bulk insert of a batch
Declaration
public override void AfterBulkInsert(string tableName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Destination table name |
Overrides
BeforeBulkInsert(String)
Called before every bulk insert of a batch
Declaration
public override void BeforeBulkInsert(string tableName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Destination table name |
Overrides
BulkDelete(ITableData)
Performs a bulk delete
Declaration
public override void BulkDelete(ITableData data)
Parameters
Type | Name | Description |
---|---|---|
ITableData | data | Batch of data |
Overrides
BulkInsert(ITableData)
Performs a bulk insert
Declaration
public override void BulkInsert(ITableData data)
Parameters
Type | Name | Description |
---|---|---|
ITableData | data | Batch of data |
Overrides
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
Type | Name | Description |
---|---|---|
ITableData | data | |
System.Collections.Generic.ICollection<System.String> | selectColumnNames | |
System.Action | beforeRowReadAction | |
System.Action | afterRowReadAction | |
System.Action<System.Object>[] | rowActions |
Overrides
BulkUpdate(ITableData, ICollection<String>, ICollection<String>)
Performs a bulk update
Declaration
public override 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 |
Overrides
CleanUpBulkInsert(String)
Called after the whole bulk insert operation (all batches)
Declaration
public override void CleanUpBulkInsert(string tablename)
Parameters
Type | Name | Description |
---|---|---|
System.String | tablename |
Overrides
Clone()
Cretes a clone of the current connection manager
Declaration
public override IConnectionManager Clone()
Returns
Type | Description |
---|---|
IConnectionManager | A instance copy of the current connection manager |
Overrides
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
PrepareBulkInsert(String)
Called before the whole bulk insert operation (all batches)
Declaration
public override void PrepareBulkInsert(string tablename)
Parameters
Type | Name | Description |
---|---|---|
System.String | tablename |