Class DbSource<TOutput>
A database source defines either a table or sql query that returns data from a database. Multiple database are supported. Use the corresponding connection manager that fits to your database.
Inheritance
Inherited Members
Namespace: ETLBox.DataFlow.Connectors
Assembly: ETLBox.dll
Syntax
public class DbSource<TOutput> : DataFlowExecutableSource<TOutput>, ILoggableTask, IDataFlowLogging, IDataFlowExecutableSource<TOutput>, IDataFlowSource<TOutput>, IDataFlowSource, IDataFlowComponent, IDataFlowExecutableSource
Type Parameters
Name | Description |
---|---|
TOutput | Type of outgoing data. |
Examples
SqlConnectionManager connMan = new SqlConnectionManager("Data Source=localhost");
DbSource<MyRow> source = new DbSource<MyRow>(connMan, "dbo.table");
Constructors
DbSource()
Declaration
public DbSource()
DbSource(IConnectionManager)
Declaration
public DbSource(IConnectionManager connectionManager)
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | Sets the ConnectionManager |
DbSource(IConnectionManager, String)
Declaration
public DbSource(IConnectionManager connectionManager, string tableName)
Parameters
Type | Name | Description |
---|---|---|
IConnectionManager | connectionManager | Sets the ConnectionManager |
System.String | tableName | Sets the TableName |
DbSource(String)
Declaration
public DbSource(string tableName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableName | Sets the TableName |
Properties
ColumnNames
By default, column names are read from the table defition, extracted from the database or parsed from the sql query. The column name is used to map the data from the database source to the right property in the object used for the data flow. If you enter your own column name list, this will override any column names that exist in the source.
Declaration
public List<string> ColumnNames { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.String> |
ConnectionManager
The connection manager used to connect to the database - use the right connection manager for your database type.
Declaration
public virtual IConnectionManager ConnectionManager { get; set; }
Property Value
Type | Description |
---|---|
IConnectionManager |
Limit
Declaration
public int Limit { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SourceTableDefinition
Pass a table definition that describe the source table. Column names can be read from the table definition (if a table name is given) or extracted from the sql query. If a TableDefinition is present, this will always be used to determine the columns names.
Declaration
public TableDefinition SourceTableDefinition { get; set; }
Property Value
Type | Description |
---|---|
TableDefinition |
Sql
A custom sql query to extract the data from the source.
Declaration
public string Sql { get; set; }
Property Value
Type | Description |
---|---|
System.String |
TableName
The name of the database table to read data from.
Declaration
public string TableName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
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 |
---|---|
System.String |
Overrides
Methods
CheckParameter()
Declaration
protected override void CheckParameter()
Overrides
CleanUpOnFaulted(Exception)
Declaration
protected override void CleanUpOnFaulted(Exception e)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e |
Overrides
CleanUpOnSuccess()
Declaration
protected override void CleanUpOnSuccess()
Overrides
OnExecutionDoAsyncWork()
Declaration
protected override void OnExecutionDoAsyncWork()
Overrides
OnExecutionDoSynchronousWork()
Declaration
protected override void OnExecutionDoSynchronousWork()