Struct Sorting
A single ORDER BY key: an expression or a resolved column index together with its direction.
public struct Sorting
- Inherited Members
- Extension Methods
Remarks
Was a struct with public mutable fields; Direction and PreparedExpression
are now properties (with private backing fields). See docs/specs/design/API-NAMING-REVIEW.md
findings P1-17 and P2-19.
Constructors
Sorting(int)
Initializes a sort key from an already-resolved result-set column index.
public Sorting(int columnIdx)
Parameters
columnIdxintThe zero-based column index.
Sorting(int, NullsPosition)
Initializes a sort key from an already-resolved result-set column index, with an explicit NULL placement.
public Sorting(int columnIdx, NullsPosition nullsPosition)
Parameters
columnIdxintThe zero-based column index.
nullsPositionNullsPositionWhere SQL
NULLvalues are placed for this key.
Exceptions
- ArgumentOutOfRangeException
nullsPositionis not a defined NullsPosition member.
Sorting(Expression)
Initializes a sort key from an expression that is translated during preparation.
public Sorting(Expression expression)
Parameters
expressionExpressionThe
ORDER BYkey expression.
Sorting(Expression, NullsPosition)
Initializes a sort key from an expression that is translated during preparation, with an explicit NULL placement.
public Sorting(Expression expression, NullsPosition nullsPosition)
Parameters
expressionExpressionThe
ORDER BYkey expression.nullsPositionNullsPositionWhere SQL
NULLvalues are placed for this key.
Exceptions
- ArgumentOutOfRangeException
nullsPositionis not a defined NullsPosition member.
Properties
ColumnIndex
The resolved result-set column index, or null when the key is an expression.
public readonly int? ColumnIndex { get; }
Property Value
- int?
Direction
Ascending or descending.
public OrderDirection Direction { readonly get; set; }
Property Value
NullsPosition
Where SQL NULL values are placed for this key. Default emits no
clause and keeps the provider default; it is the value produced by the constructor overloads that
do not take a placement.
public NullsPosition NullsPosition { readonly get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
The assigned value is not a defined NullsPosition member.
PreparedExpression
The ORDER BY key after translation (column index, parameter, ...). Populated by the
query preparer; null until then.
public Expression? PreparedExpression { readonly get; set; }
Property Value
SortExpression
The original ORDER BY expression, or null when the key is a column index.
public readonly Expression? SortExpression { get; }