Class RowTargetBase<TDerived, TInput>
An abstract dataflow worker which repeatedly executes the
OnInputRow(TInput) method when there is an input row available
Input port. The library user must inherit this class and override
to provide custom functionality.
OnInputRow(TInput) is passed the row as a parameter, and does not
itself take rows from the input port.
If the method throws an exception, the worker will receive a
This class simplifies the implementation by allowing the developer to write synchronous code that operates on a single row at a time, without having to check for the availability of incoming rows.
The derived class can additionally override RunAsync()
to add logic that runs before and after all processing of rows, in which case the base class
base.RunAsync() must be called. The derived class (or its user) can also use
to add logic.
public abstract class RowTargetBase<TDerived, TInput> : RowsTargetBase<TDerived, TInput>, IDisposeOnFinished where TDerived : RowTargetBase<TDerived, TInput> where TInput : class
The type of the derived worker. Class definition example:
The type of each
Initializes a new instance of the RowTargetBase<TDerived, TInput>
abstract dataflow worker, which repeatedly executes the
OnInputRow method when there are
input rows available on the
protected RowTargetBase(in DownstreamFactory<TInput> downstreamFactory, string workerName)
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>).
Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain
An abstract method that gets called repeatedly when there is an input row available on the
Override it and process each incoming row.
protected abstract ProgressStatus OnInputRow(TInput inputRow)
The incoming row. Guaranteed to not be
For internal use.
protected override sealed Task<ProgressStatus> OnInputRowsAsync()