Class ExtremeRowComponent<TEntity>
- Namespace
- NextORM.Extensions
- Assembly
- nextorm.extensions.dll
The public query component behind SelectWhereMin<TEntity, TValue>(EntityBuilder<TEntity>, Expression<Func<TEntity, TValue>>, ExtremeRowTies, Expression<Func<TEntity, object?>>?) and its siblings: an exclusive row-source reshape that keeps the extreme row(s). The extension methods construct and attach it; a caller that needs the component directly passes ExtremeKind explicitly.
public sealed class ExtremeRowComponent<TEntity> : IQueryComponent, IQueryComponentShape
Type Parameters
TEntityThe mapped entity type the selectors are written over.
- Inheritance
-
ExtremeRowComponent<TEntity>
- Implements
- Inherited Members
- Extension Methods
Constructors
ExtremeRowComponent(ExtremeKind, LambdaExpression, ExtremeRowTies, Expression<Func<TEntity, object?>>?)
Creates the component for one direction and one selection state.
public ExtremeRowComponent(ExtremeKind kind, LambdaExpression valueSelector, ExtremeRowTies ties, Expression<Func<TEntity, object?>>? groupBy)
Parameters
kindExtremeKindWhether the component keeps the minimum or the maximum value.
valueSelectorLambdaExpressionThe value selector; its single parameter must be typed
TEntity.tiesExtremeRowTiesWhether to keep one row or every tied row.
groupByExpression<Func<TEntity, object>>Optional grouping key;
nullselects across the whole source.
Exceptions
- ArgumentNullException
valueSelectoris null.- ArgumentException
valueSelectoris not a single-parameter lambda overTEntity.
Properties
Contribution
The contribution kind: the component replaces the row source, so only one exclusive reshape may be present.
public QueryComponentContribution Contribution { get; }
Property Value
ShapeSelectorCount
The selector count: the value selector, plus the group key when one is present.
public int ShapeSelectorCount { get; }
Property Value
ShapeSelectors
Cached shape selectors.
public LambdaExpression[] ShapeSelectors { get; }
Property Value
ShapeState
The scalar half of the pre-preparation structural identity used by the engine's raw recipe cache: the direction and the tie policy. Selectors travel through GetShapeSelector(int).
public object? ShapeState { get; }
Property Value
Slot
The component slot: one stable slot per entity type, so a second extreme-row call replaces this component in place.
public Type Slot { get; }
Property Value
Methods
BuildQuery(IQueryComponentBuildContext)
Builds the component's structural contribution into the command. Runs on a plan-cache miss only: One becomes a ranked derived source filtered on rank 1. Under All, floating value keys and nullable group keys on dialects whose public capabilities indicate risky join semantics use the rank window; other cases use aggregate+join.
public void BuildQuery(IQueryComponentBuildContext context)
Parameters
contextIQueryComponentBuildContextThe command being built and the engine expression comparer.
Exceptions
- ArgumentNullException
contextis null.
GetShapeSelector(int)
Returns the value selector (index 0) or the group key (index 1).
public LambdaExpression GetShapeSelector(int index)
Parameters
indexintZero-based selector index.
Returns
- LambdaExpression
The selector expression.
Exceptions
- ArgumentOutOfRangeException
The index is outside ShapeSelectorCount.
Prepare(IQueryComponentPrepareContext)
Validates the component against the command and returns the immutable descriptor that joins the plan key: the direction, the tie policy and both selectors, compared with the engine's expression comparer. Preparation is also where the in-memory provider and the unsupported modifiers are rejected.
public IQueryComponentDescriptor Prepare(IQueryComponentPrepareContext context)
Parameters
contextIQueryComponentPrepareContextThe command being prepared and the engine expression comparer.
Returns
- IQueryComponentDescriptor
The component's structural descriptor.
Exceptions
- ArgumentNullException
contextis null.- NotSupportedException
The command targets the in-memory provider.
- ArgumentOutOfRangeException
- BuildSqlCommandException
The command carries a modifier the reshape cannot express.