Search Results for

    Show / Hide Table of Contents

    Class DictionaryTarget<TInput, TKey, TValue>

    A dataflow target that populates an IDictionary<TKey,TValue>, by default a Dictionary<TKey,TValue>.

    The input rows can be of any type, and a function selects the key and value from each row. When the row only needs a key and value, consider using the immutable KeyValuePair<TKey,TValue> struct, or the mutable MutableKeyValue<TKey, TValue> class.

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

    Inheritance
    Object
    WorkerParent
    WorkerBase
    WorkerBase<DictionaryTarget<TInput, TKey, TValue>>
    DictionaryTarget<TInput, TKey, TValue>
    Implements
    IDisposeOnFinished
    Inherited Members
    WorkerBase<DictionaryTarget<TInput, TKey, TValue>>.AddCompletedCallback(Func<DictionaryTarget<TInput, TKey, TValue>, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerBase<DictionaryTarget<TInput, TKey, TValue>>.AddRanCallback(Func<DictionaryTarget<TInput, TKey, TValue>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
    WorkerBase<DictionaryTarget<TInput, TKey, TValue>>.AddStartingCallback(Func<DictionaryTarget<TInput, TKey, TValue>, 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 DictionaryTarget<TInput, TKey, TValue> : WorkerBase<DictionaryTarget<TInput, TKey, TValue>>, IDisposeOnFinished where TInput : class
    Type Parameters
    Name Description
    TInput

    The type of the incoming rows.

    TKey

    The type of the dictionary key.

    TValue

    The type of the dictionary value.

    Properties

    Dictionary

    Gets or sets the dictionary to store lookup items (from the incoming rows) into. If null when he worker runs, it will be set to an automatically created Dictionary<TKey,TValue>.

    The property can only be accessed when the worker is not running. The populated dictionary is only available after the worker has completed successfully.

    Note: This property is thread-safe.

    Note that the dictionary 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 in rare circumstances can be useful with a large collection.

    Declaration
    public IDictionary<TKey, TValue> Dictionary { get; set; }
    Property Value
    Type Description
    IDictionary<TKey, TValue>

    The dictionary.

    Exceptions
    Type Condition
    InvalidOperationException

    Cannot get or set the value while the worker is running.

    InitialCapacity

    Gets or sets the initial capacity if the worker creates the dictionary. Set to less than 1 to get the default (7 items). Consider setting a large capacity, ideally the exact number of unique keys that will be received, to minimize 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>

    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 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

    DictionaryTargetFactory
    MutableKeyValue<TKey, TValue>
    KeyValuePair<TKey,TValue>
    In This Article
    Back to top Copyright © 2023 Envobi Ltd