DbTypeCheck<TInput>

Class DbTypeCheck<TInput>

This component will check all properties of incoming records for type consistency against their corresponding columns in an existing database table. Flawed records can be redirected by using the LinkFlawedTo(IDataFlowDestination<TInput>) methods. Alternatively, a flawed record will either throw an exception, or the record can be redirected as an ETLBoxError using LinkErrorTo(..)

Inherited Members
Namespace: ETLBox.DataFlow
Assembly: ETLBox.dll
Syntax
    public class DbTypeCheck<TInput> : DataFlowTransformation<TInput, TInput>, IDataFlowTransformation<TInput, TInput>, IDataFlowSource<TInput>, IDataFlowSource, IDataFlowDestination<TInput>, IDataFlowDestination, IDataFlowComponent, ILoggableTask
Type Parameters
NameDescription
TInput

Constructors

DbTypeCheck()

Declaration
    public DbTypeCheck()

DbTypeCheck(IConnectionManager, string)

Declaration
    public DbTypeCheck(IConnectionManager connectionManager, string tableName)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringtableName

DbTypeCheck(string)

Declaration
    public DbTypeCheck(string tableName)
Parameters
TypeNameDescription
stringtableName

Properties

AllPropertiesMustMatch

When true, marks a row as flawed if any property in the record does not map to a table column.

Declaration
    public bool AllPropertiesMustMatch { get; set; }
Property Value
TypeDescription
bool

ColumnMapping

Maps properties in incoming rows to database columns. E.g., if the value of a property called "Id" should be compared to a database column called "Key", add a column mapping: DbColumnName: "Id" -> PropertyName: "Key".

Declaration
    public ICollection<DbColumnMap> ColumnMapping { get; set; }
Property Value
TypeDescription
ICollection<DbColumnMap>

ConnectionManager

Manages database connections - use the right connection manager that fits with your database.

Declaration
    public IConnectionManager ConnectionManager { get; set; }
Property Value
TypeDescription
IConnectionManager

CustomCheck

Allows for an additional custom check for each row beyond default type checks.

Declaration
    public Predicate<TInput> CustomCheck { get; set; }
Property Value
TypeDescription
Predicate<TInput>

FlawedSourceBlock

Internal output buffer block for flawed records.

Declaration
    public ISourceBlock<TInput> FlawedSourceBlock { get; }
Property Value
TypeDescription
ISourceBlock<TInput>

IncludeBinaryLength

For binary/varbinary columns, marks records as flawed if the byte array length exceeds the column's max length.

Declaration
    public bool IncludeBinaryLength { get; set; }
Property Value
TypeDescription
bool

IncludeCharLength

For char/varchar columns, marks records as flawed if the string length exceeds the column's max length.

Declaration
    public bool IncludeCharLength { get; set; }
Property Value
TypeDescription
bool

IncludeIdentityColumn

Includes identity columns (a.k.a auto increment or serial columns) in type checks when set to true, otherwise ignores them.

Declaration
    public bool IncludeIdentityColumn { get; set; }
Property Value
TypeDescription
bool

SourceBlock

SourceBlock from the underlying TPL.Dataflow which is used as output buffer for the component.

Declaration
    public override ISourceBlock<TInput> SourceBlock { get; }
Property Value
TypeDescription
ISourceBlock<TInput>
Overrides

TableDefinition

Table definition of the destination table. By default, the table definition is read from the database using the given TableName. Use when automatic definition reading is not possible or only specific columns are needed for comparison.

Declaration
    public TableDefinition TableDefinition { get; set; }
Property Value
TypeDescription
TableDefinition

TableName

Specifies the database table name for matching type definitions with incoming records.

Declaration
    public string TableName { get; set; }
Property Value
TypeDescription
string

TargetBlock

TargetBlock from the underlying TPL.Dataflow which is used as input buffer for the component.

Declaration
    public override ITargetBlock<TInput> TargetBlock { get; }
Property Value
TypeDescription
ITargetBlock<TInput>
Overrides

Methods

AddAutomaticVoidLinkToOtherTargets(DataFlowComponent, IDataFlowDestination)

Declaration
    protected override void AddAutomaticVoidLinkToOtherTargets(DataFlowComponent key, IDataFlowDestination voidDest)
Parameters
TypeNameDescription
DataFlowComponentkey
IDataFlowDestinationvoidDest
Overrides

CheckParameter()

Declaration
    protected override void CheckParameter()
Overrides

CleanUpOnFaulted(Exception)

Declaration
    protected override void CleanUpOnFaulted(Exception e)
Parameters
TypeNameDescription
Exceptione
Overrides

CleanUpOnSuccess()

Declaration
    protected override void CleanUpOnSuccess()
Overrides

InitCheckedParameter()

Declaration
    protected override void InitCheckedParameter()
Overrides

InitComponent()

Declaration
    protected override void InitComponent()
Overrides

LinkFlawedTo(IDataFlowDestination<TInput>)

Establishes a link from the current block to another transformation or destination. This linked component will exclusively receive the flawed records detected by the current block.

Declaration
    public IDataFlowSource<TInput> LinkFlawedTo(IDataFlowDestination<TInput> target)
Parameters
TypeNameDescription
IDataFlowDestination<TInput>target

The transformation or destination to which this block is linked.

Returns
TypeDescription
IDataFlowSource<TInput>

The component to which the duplicates are linked.

LinkFlawedTo(IDataFlowDestination<TInput>, Predicate<TInput>)

Establishes a link from the current block to another transformation or destination. This linked component will exclusively receive the flawed records detected by the current block.

Declaration
    public virtual IDataFlowSource<TInput> LinkFlawedTo(IDataFlowDestination<TInput> target, Predicate<TInput> rowsToKeep)
Parameters
TypeNameDescription
IDataFlowDestination<TInput>target

The transformation or destination to which this block is linked.

Predicate<TInput>rowsToKeep

A predicate to determine which rows to send to the connected target. Rows that satisfy this predicate (evaluate to true) are forwarded.

Returns
TypeDescription
IDataFlowSource<TInput>

The component to which the duplicates are linked.

LinkFlawedTo(IDataFlowDestination<TInput>, Predicate<TInput>, Predicate<TInput>)

Establishes a link from the current block to another transformation or destination. This linked component will exclusively receive the flawed rows by the current block.

Declaration
    public virtual IDataFlowSource<TInput> LinkFlawedTo(IDataFlowDestination<TInput> target, Predicate<TInput> rowsToKeep, Predicate<TInput> rowsIntoVoid)
Parameters
TypeNameDescription
IDataFlowDestination<TInput>target

The transformation or destination to which this block is linked.

Predicate<TInput>rowsToKeep

A predicate to determine which rows to send to the connected target. Rows that satisfy this predicate (evaluate to true) are forwarded.

Predicate<TInput>rowsIntoVoid

A predicate to filter out rows. Rows that satisfy this predicate (evaluate to true) are discarded.

Returns
TypeDescription
IDataFlowSource<TInput>

The component to which the duplicates are linked.

PrepareParameterForCheck()

Declaration
    protected override void PrepareParameterForCheck()
Overrides

Reset()

Declaration
    protected override void Reset()
Overrides

Implements