Show / Hide Table of Contents

Class MassOperations

Inheritance
object
MassOperations
OracleMassOperations
PostgreSqlMassOperations
PostgreSqlMassOperationsV2
SqlServerMassOperations
Implements
IMassOperations
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Data.Dialect
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public abstract class MassOperations : IMassOperations

Constructors

MassOperations()

Declaration
protected MassOperations()

Fields

_dbOps

Declaration
protected readonly IDatabaseOperations _dbOps
Field Value
Type Description
IDatabaseOperations

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
Type Description
Task<MassResult>

Summary of results

GetTargetInformation(string)

Declaration
protected (SoTable target, bool logToTtl) GetTargetInformation(string tableName)
Parameters
Type Name Description
string tableName
Returns
Type Description
(SoTable target, bool logToTtl)

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
Type Name Description
SoTable tempTable
SoTable targetTable
SoField tempId
SoField targetId
SoField tempStatus
IEnumerable<string> valueFields
Returns
Type Description
string

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
Type Name Description
SoTable tempTable
SoTable targetTable
SoField tempId
SoField targetId
SoField tempStatus
IEnumerable<string> valueFields
Returns
Type Description
string

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
Type Name Description
SoTable tempTable
SoTable targetTable
SoField tempId
SoField targetId
SoField tempStatus
IEnumerable<string> keys
Returns
Type Description
string

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
Type Name Description
SoTable tempTable
SoTable targetTable
SoField tempId
SoField targetId
SoField tempStatus
IEnumerable<string> keys
Returns
Type Description
string

GetZeroOutColumnsSql(SoTable, SoTable, SoField, SoField, SoField[])

Declaration
protected abstract string GetZeroOutColumnsSql(SoTable tempTable, SoTable targetTable, SoField tempId, SoField targetId, SoField[] valueFieldDefs)
Parameters
Type Name Description
SoTable tempTable
SoTable targetTable
SoField tempId
SoField targetId
SoField[] valueFieldDefs
Returns
Type Description
string

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
Type Description
Task<MassResult>

Summary of results

ReformatColumnsForImport(SoTable, string[], IEnumerable<string[]>, int[], Dictionary<ComplexKey, RowInfo>, UDefType, Dictionary<int, int>, List<List<string>>)

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
Type Description
IEnumerable<object[]>

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
Type Description
UpsertRowActionStatus

TruncateAsync(string, CancellationToken)

Drop all rows in a table

Declaration
public virtual Task<MassResult> TruncateAsync(string tableName, CancellationToken cancellationToken)
Parameters
Type Name Description
string tableName

Name of table to be truncated

CancellationToken cancellationToken
Returns
Type Description
Task<MassResult>

Summary of results

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
Type Name Description
string tableName
string[] originalColumns
string[] originalKeys
string[][] data

Outer array = row, inner = column in specified order; use Encode(object) to format non-string values

UpsertNomatchAction nomatchAction
bool returnRowStatus
CancellationToken cancellationToken
Returns
Type Description
Task<MassResult>

Summary of results

VerifyRights()

Declaration
protected void VerifyRights()

Implements

IMassOperations

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top