Search Results for

    Show / Hide Table of Contents

    Class CollectionTarget<TInput, TCollection>

    A dataflow worker with one Input, that consumes incoming rows and adds them to the Rows ICollection<T>, which by default is a List<T>.

    Note: Use the factory methods in CollectionTargetFactory to create instances of this class.

    Also note that the collection will use enough memory to hold all incoming rows.

    Inheritance
    Object
    WorkerParent
    WorkerBase
    WorkerBase<CollectionTarget<TInput, TCollection>>
    CollectionTarget<TInput, TCollection>
    CollectionTarget<TInput>
    Implements
    IDisposeOnFinished
    Inherited Members
    WorkerBase<CollectionTarget<TInput, TCollection>>.AddCompletedCallback(Func<CollectionTarget<TInput, TCollection>, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerBase<CollectionTarget<TInput, TCollection>>.AddRanCallback(Func<CollectionTarget<TInput, TCollection>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
    WorkerBase<CollectionTarget<TInput, TCollection>>.AddStartingCallback(Func<CollectionTarget<TInput, TCollection>, Task<ProgressStatus>>)
    WorkerBase.AddCompletedCallback(Func<WorkerBase, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerBase.AddRanCallback(Func<WorkerBase, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
    WorkerBase.AddStartingCallback(Func<WorkerBase, Task<ProgressStatus>>)
    WorkerBase.DefaultIsStartable()
    WorkerBase.ErroredPortErrorsWorkerProtected
    WorkerBase.ErrorOutputs
    WorkerBase.EscalateError
    WorkerBase.Inputs
    WorkerBase.IsStartable
    WorkerBase.Outputs
    WorkerBase.Parent
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(TLastWorker)
    WorkerParent.AddChildCompletedCallback(Action<WorkerBase>)
    WorkerParent.AddStartingChildrenCallback(Func<WorkerParent, Task<ProgressStatus>>)
    WorkerParent.BytesPerRowBuffer
    WorkerParent.Children
    WorkerParent.DisposeOnFinished<TDisposable>(TDisposable)
    WorkerParent.GetDownstreamFactory<TInput>()
    WorkerParent.HasChildren
    WorkerParent.IsCanceled
    WorkerParent.IsCompleted
    WorkerParent.IsCreated
    WorkerParent.IsError
    WorkerParent.IsFailed
    WorkerParent.IsFatal
    WorkerParent.IsRunning
    WorkerParent.IsSucceeded
    WorkerParent.KeepChildrenLevels
    WorkerParent.Locator
    WorkerParent.LogFactory
    WorkerParent.Logger
    WorkerParent.MaxRunningChildren
    WorkerParent.Name
    WorkerParent.RemoveChildren()
    WorkerParent.RescheduleChildren()
    WorkerParent.RunChildrenAsync(Boolean)
    WorkerParent.RunChildrenAsync()
    WorkerParent.Status
    WorkerParent.Item[String]
    WorkerParent.ToString()
    WorkerParent.WorkerSystem
    WorkerParent.DebugCommands
    WorkerParent.AggregateErrorOutputRows
    WorkerParent.AggregateOutputRows
    WorkerParent.AggregateWorkersCompleted
    WorkerParent.InstantCompleted
    WorkerParent.InstantCreated
    WorkerParent.InstantStarted
    WorkerParent.RunningDuration
    Namespace: actionETL
    Assembly: actionETL.dll
    Syntax
    public class CollectionTarget<TInput, TCollection> : WorkerBase<CollectionTarget<TInput, TCollection>>, IDisposeOnFinished where TInput : class where TCollection : class, ICollection<TInput>
    Type Parameters
    Name Description
    TInput

    The type of each Input row.

    TCollection

    The type of the collection, e.g. List<T>.

    Properties

    InitialCapacity

    Gets or sets the initial capacity if the worker creates the collection. Set to less than 1 to get the default (16 items). Consider setting a large capacity, ideally the exact number of rows that will be received, to minimize list allocations and copying. This does however increase up-front memory utilization. Cannot be set after the worker has started running.

    Note: This property is thread-safe.

    Declaration
    public int InitialCapacity { get; set; }
    Property Value
    Type Description
    Int32
    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    Input

    Gets the input port for receiving rows from an upstream worker.

    Declaration
    public InputPort<TInput> Input { get; }
    Property Value
    Type Description
    InputPort<TInput>

    Rows

    Gets or sets the collection when the worker is not running. If null when the worker runs, a List<T> will be created automatically, using InitialCapacity.

    The populated collection is only available after the worker has completed successfully.

    Note that the collection can optionally be set to null after the worker has completed, to allow it to be garbage collected before the worker itself is garbage collected, which can be useful in rare circumstances, e.g. with a large collection when the worker itself is retained for an extended time.

    Note: This property is thread-safe.

    Declaration
    public TCollection Rows { get; set; }
    Property Value
    Type Description
    TCollection
    Exceptions
    Type Condition
    InvalidOperationException

    Cannot get or set the value while the worker is 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 async Task<OutcomeStatus> RunAsync()
    Returns
    Type Description
    Task<OutcomeStatus>

    A Task describing the success or failure of the worker. An asynchronous async implementation would e.g. return OutcomeStatus.Succeeded on success, while a synchronous implementation would return OutcomeStatus.SucceededTask.

    Overrides
    WorkerParent.RunAsync()

    Implements

    IDisposeOnFinished

    See Also

    CollectionTargetFactory
    CollectionTarget<TInput>
    In This Article
    Back to top Copyright © 2023 Envobi Ltd