Class CustomSource<TOutput>

Define your own source block. This block generates data from a your own custom written functions.

Inherited Members
Namespace: ETLBox.DataFlow
Assembly: ETLBox.dll
Syntax
    public class CustomSource<TOutput> : DataFlowExecutableSource<TOutput>, IDataFlowLogging, IDataFlowExecutableSource<TOutput>, IDataFlowSource<TOutput>, IDataFlowExecutableSource, IDataFlowSource, IDataFlowComponent, ILoggableTask
Type Parameters
NameDescription
TOutput

Type of outgoing data.

Examples
 List<string> Data = new List<string>()
 {
     "Test1", "Test2", "Test3"
 };
 var source = new CustomSource<MyRow>();
 source.ReadFunc = progressCount =>
 {
     return new MyRow()
     {
         Id = progressCount + 1,
         Value = Data[progressCount]
     };    
    return result;
 };
source.ReadCompletedFunc =  progressCount => progressCount >= Data.Count;

Constructors

CustomSource()

Declaration
    public CustomSource()

CustomSource(Func<int, TOutput>, Predicate<int>)

Declaration
    public CustomSource(Func<int, TOutput> readFunc, Predicate<int> readingCompleted)
Parameters
TypeNameDescription
Func<int, TOutput>readFunc

Sets the ReadFunc

Predicate<int>readingCompleted

Sets the ReadingCompleted

Properties

ReadFunc

The function that returns a data row as output. An integer value with the current progress count is the input of the function.

Declaration
    public Func<int, TOutput> ReadFunc { get; set; }
Property Value
TypeDescription
Func<int, TOutput>

ReadingCompleted

This predicate returns true when all rows for the flow are successfully returned from the ReadFunc. An integer value with the current progress count is the input of the predicate.

Declaration
    public Predicate<int> ReadingCompleted { get; set; }
Property Value
TypeDescription
Predicate<int>

Methods

CheckParameter()

Declaration
    protected override void CheckParameter()
Overrides

CleanUpOnFaulted(Exception)

Declaration
    protected override void CleanUpOnFaulted(Exception e)
Parameters
TypeNameDescription
Exceptione
Overrides

CleanUpOnSuccess()

Declaration
    protected override void CleanUpOnSuccess()
Overrides

OnExecutionDoAsyncWork()

Declaration
    protected override void OnExecutionDoAsyncWork()
Overrides

Implements