Class OutputPortCollection<TOutput>
A collection of all (non-error) typed output ports for a worker, used by workers with an unknown number of output ports of the same type, see e.g. TypedOutputs.
Note that this class only provides members where the row type is relevant; other members are available via the Outputs property of the OutputPortCollection class.
Also note that in rare cases, a worker using this class could also have additional output ports with a different row type. This is perfectly fine, as long as only the ports with the correct row type are accessed via this class.
Implements
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public sealed class OutputPortCollection<TOutput> : IReadOnlyList<OutputPort<TOutput>>, IReadOnlyCollection<OutputPort<TOutput>>, IEnumerable<OutputPort<TOutput>>, IEnumerable where TOutput : class
Type Parameters
| Name | Description |
|---|---|
| TOutput | The row type for all typed (non-error) ports. |
Constructors
OutputPortCollection(WorkerBase)
Initializes a new instance of the OutputPortCollection<TOutput> class, a collection of all (non-error) typed output ports for a worker, used by workers with an unknown number of output ports of the same type, see e.g. TypedOutputs.
Declaration
public OutputPortCollection(WorkerBase worker)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkerBase | worker | The worker. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Properties
Count
Gets the number of ports in the collection.
Note: This property is thread-safe.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Item[Int32]
Returns the typed OutputPort<TOutput> at the specified index.
Note: This indexer is thread-safe.
Declaration
public OutputPort<TOutput> this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The port index. This corresponds to the order in which the ports were added, starting with
|
Property Value
| Type | Description |
|---|---|
| OutputPort<TOutput> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
| ArgumentException | Port had the wrong row type. |
Item[String]
Returns the typed OutputPort<TOutput> at the specified port name.
Note: This indexer is thread-safe.
Declaration
public OutputPort<TOutput> this[string name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Name of the port. |
Property Value
| Type | Description |
|---|---|
| OutputPort<TOutput> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentException | Port had the wrong row type. |
Methods
Create(String)
Creates and adds an output port to the collection. Cannot be called after the worker parent has started running its children.
Note: This method is thread-safe.
Declaration
public OutputPort<TOutput> Create(string outputPortName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | outputPortName | Name of the output port. Must be unique among the output ports on this worker. |
Returns
| Type | Description |
|---|---|
| OutputPort<TOutput> | The created output port, which is often used to assign a typed output port member, e.g. "Output". |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| InvalidOperationException | Cannot add port after the worker parent has started running its children. |
GetEnumerator()
Returns an enumerator that iterates through the collection. To use it, all the ports must have the same row type.
Note: This method is not thread-safe; use ToArray() to get or iterate over the ports in a thread-safe manner.
Declaration
public IEnumerator<OutputPort<TOutput>> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<OutputPort<TOutput>> |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Port had the wrong row type. |
ToArray()
Returns the output ports copied to a new array, with the ports cast to the generic output port type including row type. This is useful for workers where all output ports are of the same type.
The caller can manipulate the array without affecting the worker, e.g. reordering the array items.
Note: This method is thread-safe.
Declaration
public OutputPort<TOutput>[] ToArray()
Returns
| Type | Description |
|---|---|
| OutputPort<TOutput>[] |
Exceptions
| Type | Condition |
|---|---|
| InvalidCastException | An element in the sequence cannot be cast to the specified type. |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through the collection.
Note: This method is not thread-safe; use ToArray() to get or iterate over the ports in a thread-safe manner.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator |