Class RowEqualityComparer
A factory class for creating IEqualityComparer<T> instances, which compare two rows of the same type for equality, based on specified columns or on a grouping key function, using high performance generated code.
The created instances are passed to grouping overloads in AggregateTransformFactory, also see the examples in Dataflow Aggregations.
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public static class RowEqualityComparer
Methods
Create<T>(Action<IGroupByCommand>)
Creates and returns a row equality comparer by specifying columns to compare, for use with grouping overloads in AggregateTransformFactory. Note that this overload does not explicitly copy input grouping columns to output columns, which must instead be copied in the aggregation transform seed or output function. Also see Create<T, TKey>(Func<T, TKey>), as well as the examples in Dataflow Aggregations.
Declaration
public static RowEqualityComparer<T> Create<T>(Action<IGroupByCommand> groupByCommandAction)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| Action<IGroupByCommand> | groupByCommandAction | The action that specifies grouping columns. Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match. |
Returns
| Type | Description |
|---|---|
| RowEqualityComparer<T> |
Type Parameters
| Name | Description |
|---|---|
| T | The row type. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Specified name is not a column. |
| ArgumentNullException |
|
| ArgumentNullException | columnName |
| InvalidOperationException | Found more than one member match in type. |
Create<T, TKey>(Func<T, TKey>)
Creates and returns a row equality comparer by providing a grouping key function, for use with grouping overloads in AggregateTransformFactory. Also see Create<T>(Action<IGroupByCommand>), which is slightly faster than this overload (but can't perform any calculation), as well as the examples in Dataflow Aggregations.
This overload is most useful for calculating a different grouping value from a single input column, e.g. turning a mixed case string into an upper case string. It is typically easier to use other overloads when grouping on multiple input columns. Also note that this overload does not explicitly copy input grouping columns to output columns, which must instead be copied in the aggregation transform seed or output function.
Declaration
public static RowEqualityComparer<T> Create<T, TKey>(Func<T, TKey> groupByKeyFunc)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T, TKey> | groupByKeyFunc | The grouping key function. Takes the row as a parameter, and must return a value or instance to group rows by. This value must have a consistent implementation of equality comparison and of GetHashCode(), see How to: define value equality for a type for details. |
Returns
| Type | Description |
|---|---|
| RowEqualityComparer<T> |
Type Parameters
| Name | Description |
|---|---|
| T | The row type. |
| TKey | The type of the key. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|