Class RowComparer<T>
Creates a Comparison<T> (available in Comparison) and a Comparer<T> (available in Comparer) for comparing two rows of the same type, using high performance generated code.
Use RowComparer<TLeft, TRight> instead if either the rows have different types, or they are the same type and you also need to compare different columns (e.g. column "A" in one row with column "B" in the other row, even though the rows are the same type).
Also see Compare Dataflow Columns.
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public sealed class RowComparer<T> : IRowComparerCommand<T>, IFluentInterface where T : class
Type Parameters
| Name | Description |
|---|---|
| T | The type of the rows. |
Constructors
RowComparer(Action<IRowComparerCommand<T>>)
Initializes a new instance of the RowComparer<T> class
with a row comparer command action, which specifies how to compare two rows of
the same type. On return, Comparison will hold the
generated row comparer, or null if a comparison could not be created.
Comparer will hold the generated comparer, or will throw on access if
it could not be created.
Also see Compare Dataflow Columns.
Declaration
public RowComparer(Action<IRowComparerCommand<T>> rowComparerCommandAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<IRowComparerCommand<T>> | rowComparerCommandAction | The row comparer command action, which specifies which columns to include in the comparison. Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Properties
Comparer
Gets the comparer that compares two rows, or throws if it could not be created.
Declaration
public Comparer<T> Comparer { get; }
Property Value
| Type | Description |
|---|---|
| Comparer<T> |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Could not create comparer. |
Comparison
Gets the comparison that compares two rows, or null if it could not be created.
Declaration
public Comparison<T> Comparison { get; }
Property Value
| Type | Description |
|---|---|
| Comparison<T> |
Methods
ToString()
Returns a String that represents this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |
Overrides
Explicit Interface Implementations
IRowComparerCommand<T>.Asc(String)
Includes the specified column in the comparison, with values evaluated in ascending order.
Declaration
IRowComparerCommand<T> IRowComparerCommand<T>.Asc(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the column. Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match. |
Returns
| Type | Description |
|---|---|
| IRowComparerCommand<T> | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| InvalidOperationException |
|
IRowComparerCommand<T>.Asc(String, StringComparer)
Includes the specified column in the comparison, with values evaluated in ascending order.
Declaration
IRowComparerCommand<T> IRowComparerCommand<T>.Asc(string columnName, StringComparer stringComparer)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the column. Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match. |
| StringComparer | stringComparer | The string comparer. |
Returns
| Type | Description |
|---|---|
| IRowComparerCommand<T> | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
IRowComparerCommand<T>.Asc<TColumn>(String, Comparison<TColumn>)
Includes the specified column in the comparison, with values evaluated in ascending order.
Declaration
IRowComparerCommand<T> IRowComparerCommand<T>.Asc<TColumn>(string columnName, Comparison<TColumn> columnComparison)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the column. Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match. |
| Comparison<TColumn> | columnComparison | The column comparison. |
Returns
| Type | Description |
|---|---|
| IRowComparerCommand<T> | The instance itself, for chaining multiple commands together. |
Type Parameters
| Name | Description |
|---|---|
| TColumn | The type of the column. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
IRowComparerCommand<T>.Desc(String)
Includes the specified column in the comparison, with values evaluated in descending order.
Declaration
IRowComparerCommand<T> IRowComparerCommand<T>.Desc(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the column. Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match. |
Returns
| Type | Description |
|---|---|
| IRowComparerCommand<T> | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| InvalidOperationException |
|
IRowComparerCommand<T>.Desc(String, StringComparer)
Includes the specified column in the comparison, with values evaluated in descending order.
Declaration
IRowComparerCommand<T> IRowComparerCommand<T>.Desc(string columnName, StringComparer stringComparer)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the column. Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match. |
| StringComparer | stringComparer | The string comparer. |
Returns
| Type | Description |
|---|---|
| IRowComparerCommand<T> | The instance itself, for chaining multiple commands together. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
IRowComparerCommand<T>.Desc<TColumn>(String, Comparison<TColumn>)
Includes the specified column in the comparison, with values evaluated in descending order.
Declaration
IRowComparerCommand<T> IRowComparerCommand<T>.Desc<TColumn>(string columnName, Comparison<TColumn> columnComparison)
Parameters
| Type | Name | Description |
|---|---|---|
| String | columnName | Name of the column. Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match. |
| Comparison<TColumn> | columnComparison | The column comparison. |
Returns
| Type | Description |
|---|---|
| IRowComparerCommand<T> | The instance itself, for chaining multiple commands together. |
Type Parameters
| Name | Description |
|---|---|
| TColumn | The type of the column. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|