Class TypeRowSchema
Provides information about the columns in a dataflow row (i.e. a .NET CLR type) and their data types. CreateSetValueAction<T>() can also create an action that sets a column value in a dataflow row using high performance generated code, based on an index.
The class is used for working with column names and their types, e.g. for implementing column mapping directly, or for building higher level constructs such as TypeColumnCopier<TFrom, TTo>.
Use TypeRowSchema when you have access to the required .NET CLR type, since it can populate the
instance automatically from the type. Otherwise use FlatRowSchema and specify columns
explicitly.
Columns can be searched for via several Get* methods.
They can also be accessed as a flat list via the
SchemaNodeList property, and as a
hierarchical tree via the SchemaNodeRoot property,
both of which return items in a well defined order controlled by OrderAttribute.
Note that the root node of the tree is not included in the SchemaNodeList list.
The hierarchical tree and flat list include all descendant fields and properties, down
to individual columns, e.g. int, byte[], SqlBinary etc., optionally
grouped in column schemas (i.e. a struct in a field which creates a new parent node
in the tree).
See Dataflow Columns for details.
Inherited Members
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public class TypeRowSchema : RowSchemaBase<TypeRowSchema, TypeSchemaNode>
Properties
BytesPerRow
Gets the estimated size in bytes of each row. This is calculated from BytesPerType for each contained property or field, and is used together with BytesPerRowBuffer to calculate the number of dataflow rows per buffer.
You can adjust the number of rows per buffer by setting the properties (and configurations) BytesPerRowBuffer (WorkerParentBytesPerRowBuffer) and RowsPerBuffer (InputPortRowsPerBuffer).
Note that while the estimate is quite accurate for pure value types, rows with
reference types can be significantly under- or overestimated due to null values
or larger than expected referenced objects.
Declaration
public long BytesPerRow { get; }
Property Value
| Type | Description |
|---|---|
| Int64 |
RowType
Gets the .NET type for the row.
Declaration
public Type RowType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
RowTypeDisplayName
Gets the display name of the row type. See DisplayName(Type) for details.
Declaration
public string RowTypeDisplayName { get; }
Property Value
| Type | Description |
|---|---|
| String |
Methods
Create(Type)
Retrieves from cache or creates a TypeRowSchema instance for the specified row type.
One TypeRowSchema instance is cached for each requested type.
Declaration
public static TypeRowSchema Create(Type rowType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | rowType | The row type. |
Returns
| Type | Description |
|---|---|
| TypeRowSchema | A |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException | The row type must be a class or an interface (e.g. not a struct or enum). |
CreateSetValueAction<T>()
Creates an action that sets a column value in a dataflow row using high performance generated code, based on an index. This is useful when iterating over a collection of columns to assign values to. The action has a signature corresponding to:
void SetValue(T row, int schemaNodeListIndex, object value)
If the caller is generating code, e.g. with expression trees, slightly better performance can be achieved by incorporating the assignments directly into the generated code, e.g. with the aid of GetMemberAccessExpression(Expression).
Declaration
public static Action<T, int, object> CreateSetValueAction<T>()
where T : class
Returns
| Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Action<T, Int32, Object> | The action, which takes the following parameters:
|
Type Parameters
| Name | Description |
|---|---|
| T | The row type. Must be a class. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The row type must be a class, not a value type or interface. |
ToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |