Class InputPortCollection<TInput>
A collection of all typed input ports for a worker, used by workers with an unknown number of input ports of the same type, see e.g. TypedInputs.
Note that this class only provides members where the row type is relevant; other members are available via the Inputs property of the InputPortCollection class.
Also note that in rare cases, a worker using this class could also have additional input 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 class InputPortCollection<TInput> : IReadOnlyList<InputPort<TInput>>, IReadOnlyCollection<InputPort<TInput>>, IEnumerable<InputPort<TInput>>, IEnumerable where TInput : class
Type Parameters
| Name | Description |
|---|---|
| TInput | The row type of all typed input ports. |
Constructors
InputPortCollection(WorkerBase)
Initializes a new instance of the InputPortCollection<TInput> class.
Declaration
public InputPortCollection(WorkerBase worker)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkerBase | worker | The worker. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Properties
Count
Gets the number of ports in the port collection.
Note: This property is thread-safe.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Item[Int32]
Returns the typed InputPort<TInput> at the specified index.
Note: This indexer is thread-safe.
Declaration
public InputPort<TInput> this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The input port index. This corresponds to the order in which the ports were added, starting with
|
Property Value
| Type | Description |
|---|---|
| InputPort<TInput> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
| ArgumentException | Port had the wrong row type. |
Item[String]
Returns the typed InputPort<TInput> with the specified port name.
Note: This indexer is thread-safe.
Declaration
public InputPort<TInput> this[string inputPortName] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputPortName | Name of the input port. |
Property Value
| Type | Description |
|---|---|
| InputPort<TInput> |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Input |
| ArgumentException | Port had the wrong row type. |
Methods
Create(String, OutputPortBase<TInput>)
Creates and adds an input port to the collection. Cannot be called after the worker parent has started running its children.
Note: This method is thread-safe.
Declaration
public InputPort<TInput> Create(string inputPortName, OutputPortBase<TInput> inputFrom)
Parameters
| Type | Name | Description |
|---|---|---|
| String | inputPortName | Name of the input port. Must be unique among the input ports on this worker. |
| OutputPortBase<TInput> | inputFrom | The upstream output (or error output) port to link this input port from. Can be |
Returns
| Type | Description |
|---|---|
| InputPort<TInput> | The created input port, which is often used to assign a typed input port property,
e.g. with the default name |
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 input 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<InputPort<TInput>> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<InputPort<TInput>> |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Port had the wrong row type. |
ToArray()
Returns the input ports copied to a new array, with the ports cast to the generic input port type including row type. This is useful for workers where all input 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 InputPort<TInput>[] ToArray()
Returns
| Type | Description |
|---|---|
| InputPort<TInput>[] |
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 a 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 |