Class DictionaryLookupTransformFactory
Factory methods that create a DictionaryLookupTransform<TInputOutputError, TKey, TValue> or a DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue> dataflow worker, which performs a lookup of a key in an dictionary, and uses the dictionary values to modify the rows before sending them to one of the outputs.
Note that by default on .NET Framework, maximum array size is 2GB, which in turn limits the Dictionary<TKey,TValue> size with a 64-bit application (using references as key and value) to a maximum of 47.9 million items. You can remove this limit by enabling support for larger arrays, as described in <gcAllowVeryLargeObjects> Element.
.NET 6+ on the other hand supports >2GB arrays by default.
The Input port is linked to (if available) the upstream
output or error output port specified by the factory.
Get the factory from Link when the upstream port is known ahead of time (which is usually the case). Otherwise get it from GetDownstreamFactory<TInput>(), and link the transform or target explicitly using LinkTo(InputPort<TOutput>) or LinkFrom(OutputPortBase<TInput>).
Also see Dataflow Lookups.
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public static class DictionaryLookupTransformFactory
Methods
DictionaryLookupTransform<TInputOutputError, TKey, TValue>(in DownstreamFactory<TInputOutputError>, String, IReadOnlyDictionary<TKey, TValue>, Func<TInputOutputError, TKey>, Action<TInputOutputError, TKey, TValue>)
Initializes a new instance of the DictionaryLookupTransform<TInputOutputError, TKey, TValue> dataflow worker, which performs a lookup of a key in an IReadOnlyDictionary<TKey,TValue>, and uses the dictionary values to modify the rows before sending them to one of the outputs.
The Input port is linked to (if available) the upstream
output or error output port specified by the factory.
Rows where the key is found are sent to Output,
while rows where the key is not found are sent unmodified to ErrorOutput,
potentially failing the worker depending on configured maximum error rows.
Declaration
public static DictionaryLookupTransform<TInputOutputError, TKey, TValue> DictionaryLookupTransform<TInputOutputError, TKey, TValue>(this in DownstreamFactory<TInputOutputError> downstreamFactory, string workerName, IReadOnlyDictionary<TKey, TValue> dictionary, Func<TInputOutputError, TKey> selectRowKeyFunc, Action<TInputOutputError, TKey, TValue> foundKeyAction)
where TInputOutputError : class
Parameters
| Type | Name | Description |
|---|---|---|
| DownstreamFactory<TInputOutputError> | downstreamFactory | The downstream factory, which specifies the parent worker and (optionally) the upstream port to link the "first" input port of this dataflow worker to. Get it from Link when the upstream port is known ahead of time (which is usually the case). Otherwise get it from GetDownstreamFactory<TInput>(), and link the transform or target explicitly using LinkTo(InputPort<TOutput>) or LinkFrom(OutputPortBase<TInput>). |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| IReadOnlyDictionary<TKey, TValue> | dictionary | The dictionary to lookup incoming rows against.
A dictionary must be provided either here, or via
Dictionary.
The callback methods (normally |
| Func<TInputOutputError, TKey> | selectRowKeyFunc | The select key function that takes the incoming row as a parameter, and returns the key to lookup in the dictionary. |
| Action<TInputOutputError, TKey, TValue> | foundKeyAction | A method that gets called for each incoming row where the This method is typically used to modify the incoming row using the lookup value, but can also take any other action using the incoming row and the dictionary key and value. Can be |
Returns
| Type | Description |
|---|---|
| DictionaryLookupTransform<TInputOutputError, TKey, TValue> | The initialized (and optionally linked) transform. |
Type Parameters
| Name | Description |
|---|---|
| TInputOutputError | The type of all input and output port rows. |
| TKey | The type of the lookup key. |
| TValue | The type of the lookup value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
DictionaryLookupTransform<TInputOutputError, TKey, TValue>(in DownstreamFactory<TInputOutputError>, String, IReadOnlyDictionary<TKey, TValue>, Func<TInputOutputError, TKey>, Action<TInputOutputError, TKey, TValue>, Func<TInputOutputError, TKey, DictionaryLookupRowTreatment>)
Initializes a new instance of the DictionaryLookupTransform<TInputOutputError, TKey, TValue> dataflow worker, which performs a lookup of a key in an IReadOnlyDictionary<TKey,TValue>, and uses the dictionary values to modify the rows before sending them to one of the outputs.
The Input port is linked to (if available) the upstream
output or error output port specified by the factory.
Rows where the key is found are sent to Output,
while rows where the key is not found can be sent to any output.
Declaration
public static DictionaryLookupTransform<TInputOutputError, TKey, TValue> DictionaryLookupTransform<TInputOutputError, TKey, TValue>(this in DownstreamFactory<TInputOutputError> downstreamFactory, string workerName, IReadOnlyDictionary<TKey, TValue> dictionary, Func<TInputOutputError, TKey> selectRowKeyFunc, Action<TInputOutputError, TKey, TValue> foundKeyAction, Func<TInputOutputError, TKey, DictionaryLookupRowTreatment> notFoundKeyFunc)
where TInputOutputError : class
Parameters
| Type | Name | Description |
|---|---|---|
| DownstreamFactory<TInputOutputError> | downstreamFactory | The downstream factory, which specifies the parent worker and (optionally) the upstream port to link the "first" input port of this dataflow worker to. Get it from Link when the upstream port is known ahead of time (which is usually the case). Otherwise get it from GetDownstreamFactory<TInput>(), and link the transform or target explicitly using LinkTo(InputPort<TOutput>) or LinkFrom(OutputPortBase<TInput>). |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| IReadOnlyDictionary<TKey, TValue> | dictionary | The dictionary to lookup incoming rows against.
A dictionary must be provided either here, or via
Dictionary.
The callback methods (normally |
| Func<TInputOutputError, TKey> | selectRowKeyFunc | The select key function that takes the incoming row as a parameter, and returns the key to lookup in the dictionary. |
| Action<TInputOutputError, TKey, TValue> | foundKeyAction | A method that gets called for each incoming row where the This method is typically used to modify the incoming row using the lookup value, but can also take any other action using the incoming row and the dictionary key and value. Can be |
| Func<TInputOutputError, TKey, DictionaryLookupRowTreatment> | notFoundKeyFunc | A function that gets called for each incoming row where the This function is typically used to modify the incoming row, e.g. filling in default values, but can also take any other action using the incoming row and the calculated (but not found) key.
Can be |
Returns
| Type | Description |
|---|---|
| DictionaryLookupTransform<TInputOutputError, TKey, TValue> | The initialized (and optionally linked) transform. |
Type Parameters
| Name | Description |
|---|---|
| TInputOutputError | The type of all input and output port rows. |
| TKey | The type of the lookup key. |
| TValue | The type of the lookup value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
DictionaryLookupTransform<TInputOutputError, TKey, TValue>(in DownstreamFactory<TInputOutputError>, String, IReadOnlyDictionary<TKey, TValue>, Func<TInputOutputError, TKey>, Func<TInputOutputError, TKey, TValue, DictionaryLookupRowTreatment>, Func<TInputOutputError, TKey, DictionaryLookupRowTreatment>)
Initializes a new instance of the DictionaryLookupTransform<TInputOutputError, TKey, TValue> dataflow worker, which performs a lookup of a key in an IReadOnlyDictionary<TKey,TValue>, and uses the dictionary values to modify the rows before sending them to one of the outputs.
The Input port is linked to (if available) the upstream
output or error output port specified by the factory.
This overload provides full control over which output port to send the rows to.
Declaration
public static DictionaryLookupTransform<TInputOutputError, TKey, TValue> DictionaryLookupTransform<TInputOutputError, TKey, TValue>(this in DownstreamFactory<TInputOutputError> downstreamFactory, string workerName, IReadOnlyDictionary<TKey, TValue> dictionary, Func<TInputOutputError, TKey> selectRowKeyFunc, Func<TInputOutputError, TKey, TValue, DictionaryLookupRowTreatment> foundKeyFunc, Func<TInputOutputError, TKey, DictionaryLookupRowTreatment> notFoundKeyFunc)
where TInputOutputError : class
Parameters
| Type | Name | Description |
|---|---|---|
| DownstreamFactory<TInputOutputError> | downstreamFactory | The downstream factory, which specifies the parent worker and (optionally) the upstream port to link the "first" input port of this dataflow worker to. Get it from Link when the upstream port is known ahead of time (which is usually the case). Otherwise get it from GetDownstreamFactory<TInput>(), and link the transform or target explicitly using LinkTo(InputPort<TOutput>) or LinkFrom(OutputPortBase<TInput>). |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| IReadOnlyDictionary<TKey, TValue> | dictionary | The dictionary to lookup incoming rows against.
A dictionary must be provided either here, or via
Dictionary.
The callback methods (normally |
| Func<TInputOutputError, TKey> | selectRowKeyFunc | The select key function that takes the incoming row as a parameter, and returns the key to lookup in the dictionary. |
| Func<TInputOutputError, TKey, TValue, DictionaryLookupRowTreatment> | foundKeyFunc | A function that gets called for each incoming row where the This function is typically used to modify the incoming row using the lookup value, but can also take any other action using the incoming row and the dictionary key and value. Can be |
| Func<TInputOutputError, TKey, DictionaryLookupRowTreatment> | notFoundKeyFunc | A function that gets called for each incoming row where the This function is typically used to modify the incoming row, e.g. filling in default values, but can also take any other action using the incoming row and the calculated (but not found) key.
Can be |
Returns
| Type | Description |
|---|---|
| DictionaryLookupTransform<TInputOutputError, TKey, TValue> | The initialized (and optionally linked) transform. |
Type Parameters
| Name | Description |
|---|---|
| TInputOutputError | The type of all input and output port rows. |
| TKey | The type of the lookup key. |
| TValue | The type of the lookup value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>(in DownstreamFactory<TInputOutputError>, String, OutputPortBase<TDictionaryInput>, Func<TDictionaryInput, KeyValuePair<TKey, TValue>>, Func<TInputOutputError, TKey>, Action<TInputOutputError, TKey, TValue>)
Initializes a new instance of the
DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>
dataflow worker.
It first loads an IDictionary<TKey,TValue> from the DictionaryInput
port rows, then performs a lookup in the dictionary for
each Input row, optionally modifying the input rows, before sending them to
the appropriate output port: FoundOutput, NotFoundOutput,
or ErrorOutput.
The Input port is linked to (if available) the upstream
output or error output port specified by the factory.
Rows where the key is found are sent to Output, while
rows where the key is not found are sent unmodified to ErrorOutput,
potentially failing the worker depending on configured maximum error rows.
Declaration
public static DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue> DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>(this in DownstreamFactory<TInputOutputError> downstreamFactory, string workerName, OutputPortBase<TDictionaryInput> dictionaryInputFrom, Func<TDictionaryInput, KeyValuePair<TKey, TValue>> selectDictionaryKeyValueFunc, Func<TInputOutputError, TKey> selectRowKeyFunc, Action<TInputOutputError, TKey, TValue> foundKeyAction)
where TInputOutputError : class where TDictionaryInput : class
Parameters
| Type | Name | Description |
|---|---|---|
| DownstreamFactory<TInputOutputError> | downstreamFactory | The downstream factory, which specifies the parent worker and (optionally) the upstream port to link the "first" input port of this dataflow worker to. Get it from Link when the upstream port is known ahead of time (which is usually the case). Otherwise get it from GetDownstreamFactory<TInput>(), and link the transform or target explicitly using LinkTo(InputPort<TOutput>) or LinkFrom(OutputPortBase<TInput>). |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| OutputPortBase<TDictionaryInput> | dictionaryInputFrom | The upstream output (or error output) port to link the
DictionaryInput
port from.
Can be |
| Func<TDictionaryInput, KeyValuePair<TKey, TValue>> | selectDictionaryKeyValueFunc | The function callback that takes each incoming DictionaryInput row as a parameter, and returns the dictionary key and lookup value pair, via columns or calculations, e.g.:
|
| Func<TInputOutputError, TKey> | selectRowKeyFunc | The select key function that takes the incoming |
| Action<TInputOutputError, TKey, TValue> | foundKeyAction | A method that gets called for each incoming row where the This method is typically used to modify the incoming row using the lookup value, but can also take any other action using the incoming row and the dictionary key and value. Can be |
Returns
| Type | Description |
|---|---|
| DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue> |
Type Parameters
| Name | Description |
|---|---|
| TInputOutputError | The type of all input and output port rows, except for DictionaryInput. |
| TDictionaryInput | The type of DictionaryInput port rows. |
| TKey | The type of the lookup key. |
| TValue | The type of the lookup value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>(in DownstreamFactory<TInputOutputError>, String, OutputPortBase<TDictionaryInput>, Func<TDictionaryInput, KeyValuePair<TKey, TValue>>, Func<TInputOutputError, TKey>, Action<TInputOutputError, TKey, TValue>, Func<TInputOutputError, TKey, DictionaryLookupRowTreatment>)
Initializes a new instance of the
DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>
dataflow worker.
It first loads an IDictionary<TKey,TValue> from the DictionaryInput
port rows, then performs a lookup in the dictionary for
each Input row, optionally modifying the input rows, before sending them to
the appropriate output port: FoundOutput, NotFoundOutput,
or ErrorOutput.
The Input port is linked to (if available) the upstream
output or error output port specified by the factory.
This overload provides full control over which output port to send the rows to.
Rows where the key is found are sent to Output,
while rows where the key is not found can be sent to any output.
Declaration
public static DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue> DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>(this in DownstreamFactory<TInputOutputError> downstreamFactory, string workerName, OutputPortBase<TDictionaryInput> dictionaryInputFrom, Func<TDictionaryInput, KeyValuePair<TKey, TValue>> selectDictionaryKeyValueFunc, Func<TInputOutputError, TKey> selectRowKeyFunc, Action<TInputOutputError, TKey, TValue> foundKeyAction, Func<TInputOutputError, TKey, DictionaryLookupRowTreatment> notFoundKeyFunc)
where TInputOutputError : class where TDictionaryInput : class
Parameters
| Type | Name | Description |
|---|---|---|
| DownstreamFactory<TInputOutputError> | downstreamFactory | The downstream factory, which specifies the parent worker and (optionally) the upstream port to link the "first" input port of this dataflow worker to. Get it from Link when the upstream port is known ahead of time (which is usually the case). Otherwise get it from GetDownstreamFactory<TInput>(), and link the transform or target explicitly using LinkTo(InputPort<TOutput>) or LinkFrom(OutputPortBase<TInput>). |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| OutputPortBase<TDictionaryInput> | dictionaryInputFrom | The upstream output (or error output) port to link the
DictionaryInput
port from.
Can be |
| Func<TDictionaryInput, KeyValuePair<TKey, TValue>> | selectDictionaryKeyValueFunc | The function callback that takes each incoming DictionaryInput row as a parameter, and returns the dictionary key and lookup value pair, via columns or calculations, e.g.:
|
| Func<TInputOutputError, TKey> | selectRowKeyFunc | The select key function that takes the incoming |
| Action<TInputOutputError, TKey, TValue> | foundKeyAction | A method that gets called for each incoming row where the This method is typically used to modify the incoming row using the lookup value, but can also take any other action using the incoming row and the dictionary key and value. Can be |
| Func<TInputOutputError, TKey, DictionaryLookupRowTreatment> | notFoundKeyFunc | A function that gets called for each incoming row where the This function is typically used to modify the incoming row, e.g. filling in default values, but can also take any other action using the incoming row and the calculated (but not found) key.
Can be |
Returns
| Type | Description |
|---|---|
| DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue> | The initialized (and optionally linked) transform. |
Type Parameters
| Name | Description |
|---|---|
| TInputOutputError | The type of all input and output port rows, except for DictionaryInput. |
| TDictionaryInput | The type of DictionaryInput port rows. |
| TKey | The type of the lookup key. |
| TValue | The type of the lookup value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>(in DownstreamFactory<TInputOutputError>, String, OutputPortBase<TDictionaryInput>, Func<TDictionaryInput, KeyValuePair<TKey, TValue>>, Func<TInputOutputError, TKey>, Func<TInputOutputError, TKey, TValue, DictionaryLookupRowTreatment>, Func<TInputOutputError, TKey, DictionaryLookupRowTreatment>)
Initializes a new instance of the
DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>
dataflow worker.
It first loads an IDictionary<TKey,TValue> from the DictionaryInput
port rows, then performs a lookup in the dictionary for
each Input row, optionally modifying the input rows, before sending them to
the appropriate output port: FoundOutput, NotFoundOutput,
or ErrorOutput.
The Input port is linked to (if available) the upstream
output or error output port specified by the factory.
This overload provides full control over which output port to send the rows to.
Declaration
public static DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue> DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue>(this in DownstreamFactory<TInputOutputError> downstreamFactory, string workerName, OutputPortBase<TDictionaryInput> dictionaryInputFrom, Func<TDictionaryInput, KeyValuePair<TKey, TValue>> selectDictionaryKeyValueFunc, Func<TInputOutputError, TKey> selectRowKeyFunc, Func<TInputOutputError, TKey, TValue, DictionaryLookupRowTreatment> foundKeyFunc, Func<TInputOutputError, TKey, DictionaryLookupRowTreatment> notFoundKeyFunc)
where TInputOutputError : class where TDictionaryInput : class
Parameters
| Type | Name | Description |
|---|---|---|
| DownstreamFactory<TInputOutputError> | downstreamFactory | The downstream factory, which specifies the parent worker and (optionally) the upstream port to link the "first" input port of this dataflow worker to. Get it from Link when the upstream port is known ahead of time (which is usually the case). Otherwise get it from GetDownstreamFactory<TInput>(), and link the transform or target explicitly using LinkTo(InputPort<TOutput>) or LinkFrom(OutputPortBase<TInput>). |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| OutputPortBase<TDictionaryInput> | dictionaryInputFrom | The upstream output (or error output) port to link the
DictionaryInput
port from.
Can be |
| Func<TDictionaryInput, KeyValuePair<TKey, TValue>> | selectDictionaryKeyValueFunc | The function callback that takes each incoming DictionaryInput row as a parameter, and returns the dictionary key and lookup value pair, via columns or calculations, e.g.:
|
| Func<TInputOutputError, TKey> | selectRowKeyFunc | The select key function that takes the incoming |
| Func<TInputOutputError, TKey, TValue, DictionaryLookupRowTreatment> | foundKeyFunc | A function that gets called for each incoming row where the This function is typically used to modify the incoming row using the lookup value, but can also take any other action using the incoming row and the dictionary key and value. Can be |
| Func<TInputOutputError, TKey, DictionaryLookupRowTreatment> | notFoundKeyFunc | A function that gets called for each incoming row where the This function is typically used to modify the incoming row, e.g. filling in default values, but can also take any other action using the incoming row and the calculated (but not found) key.
Can be |
Returns
| Type | Description |
|---|---|
| DictionaryLookupTransform<TInputOutputError, TDictionaryInput, TKey, TValue> | The initialized (and optionally linked) transform. |
Type Parameters
| Name | Description |
|---|---|
| TInputOutputError | The type of all input and output port rows, except for DictionaryInput. |
| TDictionaryInput | The type of DictionaryInput port rows. |
| TKey | The type of the lookup key. |
| TValue | The type of the lookup value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|