Class BulkUpdateBase
Common base class for BulkUpdate.
Implements
Namespace: Kros.Data.BulkActions
Assembly: Kros.Utils.dll
Syntax
public abstract class BulkUpdateBase : IBulkUpdate, IDisposable
Fields
_connection
Connection.
Declaration
protected IDbConnection _connection
Field Value
| Type | Description |
|---|---|
| System.Data.IDbConnection |
_disposeOfConnection
true if dispose of the connection is necessary, otherwise false.
Declaration
protected bool _disposeOfConnection
Field Value
| Type | Description |
|---|---|
| System.Boolean |
PrefixTempTable
Temporary table prefix.
Declaration
protected const char PrefixTempTable = '#'
Field Value
| Type | Description |
|---|---|
| System.Char |
Properties
DestinationTableName
Destination table name in database.
Declaration
public string DestinationTableName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
ExternalTransaction
External transaction in which the operation is executed.
Declaration
public IDbTransaction ExternalTransaction { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.Data.IDbTransaction |
PrimaryKeyColumn
Primary key.
Declaration
public string PrimaryKeyColumn { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
TempTableAction
Action, executed on temporary table.
Declaration
public Action<IDbConnection, IDbTransaction, string> TempTableAction { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Action<System.Data.IDbConnection, System.Data.IDbTransaction, System.String> |
Remarks
Action, which will be executed on temp table (additional modification of data).
Methods
CreateBulkInsert()
Creates BulkInsert.
Declaration
protected abstract IBulkInsert CreateBulkInsert()
Returns
| Type | Description |
|---|---|
| IBulkInsert | Bulk insert. |
CreateCommandForPrimaryKey()
Returns command for creating primary key.
Declaration
protected abstract IDbCommand CreateCommandForPrimaryKey()
Returns
| Type | Description |
|---|---|
| System.Data.IDbCommand |
CreateTempTable(IDataReader, String)
Creates temporary table by reader.
Declaration
protected abstract void CreateTempTable(IDataReader reader, string tempTableName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.IDataReader | reader | Reader for accessing data. |
| System.String | tempTableName | Name of temporary table. |
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
DoneTempTableAsync(String, Boolean)
Ends work with temporary table.
Declaration
protected virtual Task DoneTempTableAsync(string tempTableName, bool useAsync)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | tempTableName | Temporary table name. |
| System.Boolean | useAsync | true if action can by executed asynchronously. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
GetColumnNamesForTempTable(IDataReader)
List of temporary table columns.
Declaration
protected string GetColumnNamesForTempTable(IDataReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.IDataReader | reader | Reader for accesing data. |
Returns
| Type | Description |
|---|---|
| System.String |
GetTempTableName()
Returns name of temporary table.
Declaration
protected abstract string GetTempTableName()
Returns
| Type | Description |
|---|---|
| System.String |
GetTempTableNameForBulkInsert(String)
Returns formatted name of temporary table for BulkInsert.
Declaration
protected virtual string GetTempTableNameForBulkInsert(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Temporary table name. |
Returns
| Type | Description |
|---|---|
| System.String |
GetUpdateColumnNames(IDataReader, String)
List of temporary table columns.
Declaration
protected string GetUpdateColumnNames(IDataReader reader, string tempTableName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.IDataReader | reader | Reader for accesing data. |
| System.String | tempTableName | Temporary table name. |
Returns
| Type | Description |
|---|---|
| System.String |
InvokeAction(String)
Invokes action in temporary database.
Declaration
protected abstract void InvokeAction(string tempTableName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | tempTableName | Name of temporary table. |
Update(IBulkActionDataReader)
Updates all data from source reader.
Declaration
public void Update(IBulkActionDataReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| IBulkActionDataReader | reader | Data source. |
Update(DataTable)
Updates all data from table table.
Declaration
public void Update(DataTable table)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.DataTable | table | Data source. |
Update(IDataReader)
Updates all data from source reader.
Declaration
public void Update(IDataReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.IDataReader | reader | Data source. |
UpdateAsync(IBulkActionDataReader)
Asynchronously updates all data from source reader.
Declaration
public Task UpdateAsync(IBulkActionDataReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| IBulkActionDataReader | reader | Data source. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous Insert operation. |
UpdateAsync(DataTable)
Asynchronously updates all data from table table.
Declaration
public Task UpdateAsync(DataTable table)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.DataTable | table | Data source. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous Insert operation. |
UpdateAsync(IDataReader)
Asynchronously updates all data from source reader.
Declaration
public Task UpdateAsync(IDataReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.IDataReader | reader | Data source. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous Insert operation. |
UpdateDestinationTableAsync(IDataReader, String, Boolean)
Executes update on destination table.
Declaration
protected abstract Task UpdateDestinationTableAsync(IDataReader reader, string tempTableName, bool useAsync)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Data.IDataReader | reader | Reader for accesing data. |
| System.String | tempTableName | Temporary table name. |
| System.Boolean | useAsync | true if action can by executed asynchronously. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |