Search Results for

    Show / Hide Table of Contents

    Class RepeatRowsSource<TOutput>

    A dataflow worker that generates an arbitrary number of rows, often used for testing, debugging etc. The caller provides template rows as an IEnumerable, or as rows specified in the constructor, which are by default repeatedly cloned (using CreateDeepCloneFunc()) in a round-robin fashion, to generate and pass the output rows to a downstream worker. This way, only the new cloned rows with distinct references are sent downstream.

    Note: When cloning rows (the default), all mapped column data types must support multi-copy. To only select some columns for copying, use ColumnMapperCommandAction.

    Alternatively, you can set SendTemplateRows to true to instead repeatedly send the template rows as is downstream. Note that if true and TotalNumberOfRows is larger than the number of template rows, the same row object reference will be sent multiple times, which is strongly discouraged unless the row type is immutable, or you can guarantee that no downstream worker will modify the rows. See Row Ownership for details.

    By default, all (readable and writable) columns in the template rows are included in the cloning. Use ColumnMapperCommandAction to only clone selected columns.

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

    The type of each Output row.

    Constructors

    RepeatRowsSource(WorkerParent, String, Func<Boolean>, Int64, TOutput[])

    Initializes a new instance of the RepeatRowsSource<TOutput> dataflow worker that generates an arbitrary number of rows by cloning provided template rows, and passes them to a downstream worker.

    Declaration
    public RepeatRowsSource(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, long totalNumberOfRows, 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 null.

    String workerName

    Name of the worker.

    Set to a prefix plus a trailing "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<Boolean> isStartableFunc

    Function to calculate the worker start constraint; it should return true for startable and false for not startable. Defaults to startable if null.

    Int64 totalNumberOfRows

    The total number of rows to generate.

    TOutput[] rows

    The template rows to generate output rows from.

    Exceptions
    Type Condition
    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    RepeatRowsSource(WorkerParent, String, Func<Boolean>, Int64, IEnumerable<TOutput>)

    Initializes a new instance of the RepeatRowsSource<TOutput> dataflow worker that generates an arbitrary number of rows by cloning provided template rows, and passes them to a downstream worker.

    Declaration
    public RepeatRowsSource(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, long totalNumberOfRows, IEnumerable<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 null.

    String workerName

    Name of the worker.

    Set to a prefix plus a trailing "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<Boolean> isStartableFunc

    Function to calculate the worker start constraint; it should return true for startable and false for not startable. Defaults to startable if null.

    Int64 totalNumberOfRows

    The total number of rows to generate.

    IEnumerable<TOutput> rows

    The enumerable with template rows to generate output rows from.

    Exceptions
    Type Condition
    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    RepeatRowsSource(WorkerParent, String, Int64, TOutput[])

    Initializes a new instance of the RepeatRowsSource<TOutput> dataflow worker that generates an arbitrary number of rows by cloning provided template rows, and passes them to a downstream worker.

    Declaration
    public RepeatRowsSource(WorkerParent workerParent, string workerName, long totalNumberOfRows, 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 null.

    String workerName

    Name of the worker.

    Set to a prefix plus a trailing "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Int64 totalNumberOfRows

    The total number of rows to generate.

    TOutput[] rows

    The template rows to generate output rows from.

    Exceptions
    Type Condition
    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    RepeatRowsSource(WorkerParent, String, Int64, IEnumerable<TOutput>)

    Initializes a new instance of the RepeatRowsSource<TOutput> dataflow worker that generates an arbitrary number of rows by cloning provided template rows, and passes them to a downstream worker.

    Declaration
    public RepeatRowsSource(WorkerParent workerParent, string workerName, long totalNumberOfRows, IEnumerable<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 null.

    String workerName

    Name of the worker.

    Set to a prefix plus a trailing "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Int64 totalNumberOfRows

    The total number of rows to generate.

    IEnumerable<TOutput> rows

    The enumerable with template rows to generate output rows from.

    Exceptions
    Type Condition
    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    Properties

    ColumnMapperCommandAction

    Gets or sets the column mapping. Defaults to mapping all columns, i.e. cb => cb.AutoName(). Set this property to only map selected columns, see Dataflow Column Mapping for details. Columns that are not mapped will retain their default value in the output rows, which can be used to avoid copying SingleShallow columns (which would fail). Cannot be set after the worker has started running.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    Note: This property is thread-safe.

    Declaration
    public Action<IColumnMapperCommand> ColumnMapperCommandAction { get; set; }
    Property Value
    Type Description
    Action<IColumnMapperCommand>
    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    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 an enumerable that contains or produces the template rows. This overwrites any template rows specified in the constructor. 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.

    SendTemplateRows

    Gets or sets whether to repeatedly send the template rows as is (true), or repeatedly clone them and only send cloned rows (false, the default).

    Note that if true and TotalNumberOfRows is larger than the number of template rows, the same row object reference will be sent multiple times, which is strongly discouraged unless the row type is immutable, or you can guarantee that no downstream worker will modify the rows. See Row Ownership for details.

    Cannot be set after the worker has started running.

    Note: This property is thread-safe.

    Declaration
    public bool SendTemplateRows { get; set; }
    Property Value
    Type Description
    Boolean
    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    TotalNumberOfRows

    Get or sets the total number of rows to generate. Cannot be set after the worker has started running.

    Note: This property is thread-safe.

    Declaration
    public long TotalNumberOfRows { get; set; }
    Property Value
    Type Description
    Int64
    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 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
    In This Article
    Back to top Copyright © 2023 Envobi Ltd