Class SelectGroupComponent<TEntity>
- Namespace
- NextORM.Extensions
- Assembly
- nextorm.extensions.dll
The packaged grouping operator: implements SelectGroup and SelectGroupHaving entirely
on the public Core preparation-contribution mechanism.
public sealed class SelectGroupComponent<TEntity> : IQueryComponent, IQueryComponentShape
Type Parameters
TEntity
- Inheritance
-
SelectGroupComponent<TEntity>
- Implements
- Inherited Members
- Extension Methods
Remarks
The component claims the exclusive grouping slot, so a command carries at most one grouping owner. Prepare(IQueryComponentPrepareContext) infers the grouping keys from the projection, classifies the command into a SelectGroupMode and returns an immutable descriptor whose structural hash and equality take part in the plan key. The statement itself is rendered by the engine from the effective prepared state, so BuildQuery(IQueryComponentBuildContext) has nothing to build.
Constructors
SelectGroupComponent(LambdaExpression, LambdaExpression?)
Creates the component for projection, optionally with a HAVING condition.
public SelectGroupComponent(LambdaExpression projection, LambdaExpression? condition = null)
Parameters
projectionLambdaExpressionThe projection whose aggregate-free, row-dependent subexpressions become the grouping keys.
conditionLambdaExpressionAn additional
HAVINGpredicate typed on the projection result, AND-ed with any existing sourceHaving; null forSelectGroup. Each member of the result is rebound to the projection expression that produces it during Prepare(IQueryComponentPrepareContext).
Properties
Contribution
The contribution mode: ExclusiveGrouping — the component owns the grouping of the command.
public QueryComponentContribution Contribution { get; }
Property Value
ShapeSelectorCount
One selector — the condition — when the component carries a HAVING condition; zero otherwise.
public int ShapeSelectorCount { get; }
Property Value
ShapeSelectors
Cached shape selectors, materialized once per component instance.
public LambdaExpression[] ShapeSelectors { get; }
Property Value
ShapeState
The scalar part of the raw-shape identity: whether the component carries a HAVING condition.
The projection itself is already part of the command's raw shape.
public object? ShapeState { get; }
Property Value
Slot
The slot identity of the operator: SelectGroup and SelectGroupHaving share it, so a
second call replaces the component in place instead of nesting.
public Type Slot { get; }
Property Value
Methods
BuildQuery(IQueryComponentBuildContext)
Does nothing: the engine renders the statement from the effective prepared state.
public void BuildQuery(IQueryComponentBuildContext context)
Parameters
contextIQueryComponentBuildContext
GetShapeSelector(int)
Returns the condition selector; only index 0 is valid, and only when a condition is present.
public LambdaExpression GetShapeSelector(int index)
Parameters
indexint
Returns
Prepare(IQueryComponentPrepareContext)
Infers the grouping keys from the projection, validates it together with the effective HAVING
and the expression ordering, and returns the immutable preparation contribution for the engine.
public IQueryComponentDescriptor Prepare(IQueryComponentPrepareContext context)
Parameters
contextIQueryComponentPrepareContextThe preparation context over the command being prepared.
Returns
- IQueryComponentDescriptor
An immutable descriptor carrying the grouping contribution.
Exceptions
- NotSupportedException
The command targets the in-memory provider.
- QueryPreparationException
The command shape cannot be grouped by inference.