Class EnumerableSource<TOutput>
A dataflow worker that consumes rows from an IEnumerable<T>, or individual rows specified in the constructor, and passes the rows to a downstream worker.
Providing an IEnumerable<T> makes it easy to consume the rows from methods such as ReadLines(String) as well as from LINQ queries.
Implements
Inherited Members
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public class EnumerableSource<TOutput> : WorkerBase<EnumerableSource<TOutput>>, IDisposeOnFinished where TOutput : class
Type Parameters
Name | Description |
---|---|
TOutput | The type of each |
Constructors
EnumerableSource(WorkerParent, String, TOutput[])
Initializes a new instance of the EnumerableSource<TOutput> dataflow worker that consumes rows specified in the constructor, and passes the rows to a downstream worker.
Declaration
public EnumerableSource(WorkerParent workerParent, string workerName, params TOutput[] rows)
Parameters
Type | Name | Description |
---|---|---|
WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
TOutput[] | rows | The rows to output. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException |
|
ArgumentNullException |
|
InvalidOperationException |
|
EnumerableSource(WorkerParent, String, IEnumerable<TOutput>)
Initializes a new instance of the EnumerableSource<TOutput> dataflow worker
that consumes rows from an IEnumerable
,
and passes the rows to a downstream worker.
Providing an IEnumerable<T> makes it easy to consume the rows from methods such as ReadLines(String) as well as from LINQ queries.
Declaration
public EnumerableSource(WorkerParent workerParent, string workerName, IEnumerable<TOutput> enumerableRows)
Parameters
Type | Name | Description |
---|---|---|
WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
IEnumerable<TOutput> | enumerableRows | The enumerable with rows to output. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException |
|
ArgumentNullException |
|
InvalidOperationException |
|
EnumerableSource(WorkerParent, String, Func<Boolean>, TOutput[])
Initializes a new instance of the EnumerableSource<TOutput> dataflow worker that consumes rows specified in the constructor, and passes the rows to a downstream worker.
Declaration
public EnumerableSource(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, params TOutput[] rows)
Parameters
Type | Name | Description |
---|---|---|
WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
Func<Boolean> | isStartableFunc | Function to calculate the worker start constraint; it should return |
TOutput[] | rows | The rows to output. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException |
|
ArgumentNullException |
|
InvalidOperationException |
|
EnumerableSource(WorkerParent, String, Func<Boolean>, IEnumerable<TOutput>)
Initializes a new instance of the EnumerableSource<TOutput> dataflow worker
that consumes rows from an IEnumerable
,
and passes the rows to a downstream worker.
Providing an IEnumerable<T> makes it easy to consume the rows from methods such as ReadLines(String) as well as from LINQ queries.
Declaration
public EnumerableSource(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, IEnumerable<TOutput> enumerableRows)
Parameters
Type | Name | Description |
---|---|---|
WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
Func<Boolean> | isStartableFunc | Function to calculate the worker start constraint; it should return |
IEnumerable<TOutput> | enumerableRows | The enumerable with rows to output. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentException |
|
ArgumentNullException |
|
InvalidOperationException |
|
Properties
Output
Gets the output port for sending rows to the downstream worker.
Declaration
public OutputPort<TOutput> Output { get; }
Property Value
Type | Description |
---|---|
OutputPort<TOutput> |
Rows
Sets the enumerable that produces the rows. Cannot be set after the worker has started running.
Note: This property is thread-safe.
Declaration
public IEnumerable<TOutput> Rows { set; }
Property Value
Type | Description |
---|---|
IEnumerable<TOutput> |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Cannot set the value after the worker has started running. |
Methods
RunAsync()
This method can be overridden to add custom functionality to the derived worker that runs before
and after the row processing. In this case, the base class base.RunAsync()
must
be called for the worker to function correctly.
Typically, this worker is used without overriding this method.
Declaration
protected override Task<OutcomeStatus> RunAsync()
Returns
Type | Description |
---|---|
Task<OutcomeStatus> | A |