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(..)
Implements
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
Name | Description |
---|---|
TInput |
Constructors
DbTypeCheck()
Declaration
public DbTypeCheck()
DbTypeCheck(IConnectionManager, string)
Declaration
public DbTypeCheck(IConnectionManager connectionManager, string tableName)
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | |
string | tableName |
DbTypeCheck(string)
Declaration
public DbTypeCheck(string tableName)
Parameters
Type | Name | Description |
---|---|---|
string | tableName |
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
Type | Description |
---|---|
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
Type | Description |
---|---|
ICollection<DbColumnMap> |
ConnectionManager
Manages database connections - use the right connection manager that fits with your database.
Declaration
public IConnectionManager ConnectionManager { get; set; }
Property Value
Type | Description |
---|---|
IConnectionManager |
CustomCheck
Allows for an additional custom check for each row beyond default type checks.
Declaration
public Predicate<TInput> CustomCheck { get; set; }
Property Value
Type | Description |
---|---|
Predicate<TInput> |
FlawedSourceBlock
Internal output buffer block for flawed records.
Declaration
public ISourceBlock<TInput> FlawedSourceBlock { get; }
Property Value
Type | Description |
---|---|
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
Type | Description |
---|---|
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
Type | Description |
---|---|
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
Type | Description |
---|---|
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
Type | Description |
---|---|
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
Type | Description |
---|---|
TableDefinition |
TableName
Specifies the database table name for matching type definitions with incoming records.
Declaration
public string TableName { get; set; }
Property Value
Type | Description |
---|---|
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
Type | Description |
---|---|
ITargetBlock<TInput> |
Overrides
Methods
AddComplementVoidLinkToOtherTargets(Func<Type, IDataFlowDestination>, Delegate)
Declaration
protected override void AddComplementVoidLinkToOtherTargets(Func<Type, IDataFlowDestination> createAutomaticVoidDestination, Delegate pred)
Parameters
Type | Name | Description |
---|---|---|
Func<Type, IDataFlowDestination> | createAutomaticVoidDestination | |
Delegate | pred |
Overrides
CheckParameter()
Declaration
protected override void CheckParameter()
Overrides
CleanUpOnFaulted(Exception)
Declaration
protected override void CleanUpOnFaulted(Exception e)
Parameters
Type | Name | Description |
---|---|---|
Exception | e |
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
Type | Name | Description |
---|---|---|
IDataFlowDestination<TInput> | target | The transformation or destination to which this block is linked. |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
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
Type | Description |
---|---|
IDataFlowSource<TInput> | The component to which the duplicates are linked. |
PrepareParameterForCheck()
Declaration
protected override void PrepareParameterForCheck()
Overrides
Reset()
Declaration
protected override void Reset()