Class MassOperations
Inheritance
MassOperations
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public abstract class MassOperations : IMassOperations
Constructors
MassOperations()
Declaration
protected MassOperations()
Fields
_dbOps
Declaration
protected readonly IDatabaseOperations _dbOps
Field Value
Methods
DeleteAsync(string, int[])
Delete rows, by primary key
Declaration
public virtual Task<MassResult> DeleteAsync(string tableName, int[] iDs)
Parameters
| Type |
Name |
Description |
| string |
tableName |
|
| int[] |
iDs |
Primary keys of the rows to be deleted
|
Returns
Declaration
protected (SoTable target, bool logToTtl) GetTargetInformation(string tableName)
Parameters
| Type |
Name |
Description |
| string |
tableName |
|
Returns
GetUpdateTargetFromTempSql(SoTable, SoTable, SoField, SoField, SoField, IEnumerable<string>)
Declaration
protected abstract string GetUpdateTargetFromTempSql(SoTable tempTable, SoTable targetTable, SoField tempId, SoField targetId, SoField tempStatus, IEnumerable<string> valueFields)
Parameters
Returns
GetUpdateTempTableWithDataMatchSql(SoTable, SoTable, SoField, SoField, SoField, IEnumerable<string>)
Declaration
protected abstract string GetUpdateTempTableWithDataMatchSql(SoTable tempTable, SoTable targetTable, SoField tempId, SoField targetId, SoField tempStatus, IEnumerable<string> valueFields)
Parameters
Returns
GetUpdateTempTableWithKeyMatchSql(SoTable, SoTable, SoField, SoField, SoField, IEnumerable<string>)
Declaration
protected abstract string GetUpdateTempTableWithKeyMatchSql(SoTable tempTable, SoTable targetTable, SoField tempId, SoField targetId, SoField tempStatus, IEnumerable<string> keys)
Parameters
Returns
GetUpdateTempTableWithNewKeysSql(SoTable, SoTable, SoField, SoField, SoField, IEnumerable<string>)
Declaration
protected abstract string GetUpdateTempTableWithNewKeysSql(SoTable tempTable, SoTable targetTable, SoField tempId, SoField targetId, SoField tempStatus, IEnumerable<string> keys)
Parameters
Returns
GetZeroOutColumnsSql(SoTable, SoTable, SoField, SoField, SoField[])
Declaration
protected abstract string GetZeroOutColumnsSql(SoTable tempTable, SoTable targetTable, SoField tempId, SoField targetId, SoField[] valueFieldDefs)
Parameters
Returns
InsertAsync(string, string[], string[][], CancellationToken)
Mass-insert rows, with or without primary keys specified
Declaration
public virtual Task<MassResult> InsertAsync(string tableName, string[] columns, string[][] data, CancellationToken cancellationToken)
Parameters
| Type |
Name |
Description |
| string |
tableName |
|
| string[] |
columns |
List of column names, in the same order as in the data
|
| string[][] |
data |
Outer array = row, inner = column in specified order; use CultureDataFormatter to format values
|
| CancellationToken |
cancellationToken |
|
Returns
Take all the prepared mapping, udef, substitution and all other information and transform into actual data rows that perfectly fit the physical target table
Declaration
protected IEnumerable<object[]> ReformatColumnsForImport(SoTable table, string[] columns, IEnumerable<string[]> data, int[] keyColumnIndexes = null, Dictionary<ComplexKey, MassOperations.RowInfo> keyedData = null, UDefType udefType = UDefType.None, Dictionary<int, int> substitutedColumnIndexes = null, List<List<string>> substitutedColumnData = null)
Parameters
| Type |
Name |
Description |
| SoTable |
table |
Name of target table, can be the temporary table used for matching and updating
|
| string[] |
columns |
List of columns that matches table columns
|
| IEnumerable<string[]> |
data |
Original data from client, unchanged
|
| int[] |
keyColumnIndexes |
Indexes (positions) of the key columns
|
| Dictionary<ComplexKey, MassOperations.RowInfo> |
keyedData |
Client's data represented as a (keys) => (values) dictionary; populated by a child of this method
|
| UDefType |
udefType |
Udef type, if any; controls the defaulting of unassigned columns
|
| Dictionary<int, int> |
substitutedColumnIndexes |
Indexes of columns that should use values from substitutedColumnData rather than data
|
| List<List<string>> |
substitutedColumnData |
Values to substitute for those columns that should not use the original data
|
Returns
ToCarrierStatus(int)
Convert from internal match enum to carrier - trivial, but a good API / implementation partition
Declaration
protected static UpsertRowActionStatus ToCarrierStatus(int status)
Parameters
| Type |
Name |
Description |
| int |
status |
|
Returns
TruncateAsync(string, CancellationToken)
Declaration
public virtual Task<MassResult> TruncateAsync(string tableName, CancellationToken cancellationToken)
Parameters
Returns
UpsertAsync(string, string[], string[], string[][], UpsertNomatchAction, bool, CancellationToken)
Insert or update rows. See parameters for further documentaiton.
Declaration
public virtual Task<MassResult> UpsertAsync(string tableName, string[] originalColumns, string[] originalKeys, string[][] data, UpsertNomatchAction nomatchAction, bool returnRowStatus = false, CancellationToken cancellationToken = default)
Parameters
Returns
VerifyRights()
Declaration
protected void VerifyRights()
Implements
Extension Methods