Class CustomSource<TOutput>
Define your own source block. This block generates data from a your own custom written functions.
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: ETLBox.DataFlow.Connectors
Assembly: ETLBox.dll
Syntax
public class CustomSource<TOutput> : DataFlowExecutableSource<TOutput>, ILoggableTask, IDataFlowLogging, IDataFlowExecutableSource<TOutput>, IDataFlowSource<TOutput>, IDataFlowSource, IDataFlowComponent, IDataFlowExecutableSource
Type Parameters
Name | Description |
---|---|
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()
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;
CustomSource(Func<int, TOutput>, Predicate<int>)
Declaration
public CustomSource(Func<int, TOutput> readFunc, Predicate<int> readingCompleted)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><int, TOutput> | readFunc | Sets the ReadFunc |
System.Predicate<T><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
Type | Description |
---|---|
System.Func<T, TResult><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
Type | Description |
---|---|
System.Predicate<T><int> |
TaskName
A name to identify the task or component. Every component or task comes with a default name that can be overwritten.
Declaration
public override string TaskName { get; set; }
Property Value
Type | Description |
---|---|
string |
Overrides
Methods
CheckParameter()
Declaration
protected override void CheckParameter()
Overrides
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;
CleanUpOnFaulted(Exception)
Declaration
protected override void CleanUpOnFaulted(Exception e)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e |
Overrides
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;
CleanUpOnSuccess()
Declaration
protected override void CleanUpOnSuccess()
Overrides
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;
OnExecutionDoAsyncWork()
Declaration
protected override void OnExecutionDoAsyncWork()
Overrides
ETLBox.DataFlow.DataFlowExecutableSource<TOutput>.OnExecutionDoAsyncWork()
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;
OnExecutionDoSynchronousWork()
Declaration
protected override void OnExecutionDoSynchronousWork()
Overrides
ETLBox.DataFlow.DataFlowExecutableSource<TOutput>.OnExecutionDoSynchronousWork()
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;