Table of Contents

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

projection LambdaExpression

The projection whose aggregate-free, row-dependent subexpressions become the grouping keys.

condition LambdaExpression

An additional HAVING predicate typed on the projection result, AND-ed with any existing source Having; null for SelectGroup. 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

QueryComponentContribution

ShapeSelectorCount

One selector — the condition — when the component carries a HAVING condition; zero otherwise.

public int ShapeSelectorCount { get; }

Property Value

int

ShapeSelectors

Cached shape selectors, materialized once per component instance.

public LambdaExpression[] ShapeSelectors { get; }

Property Value

LambdaExpression[]

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

object

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

Type

Methods

BuildQuery(IQueryComponentBuildContext)

Does nothing: the engine renders the statement from the effective prepared state.

public void BuildQuery(IQueryComponentBuildContext context)

Parameters

context IQueryComponentBuildContext

GetShapeSelector(int)

Returns the condition selector; only index 0 is valid, and only when a condition is present.

public LambdaExpression GetShapeSelector(int index)

Parameters

index int

Returns

LambdaExpression

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

context IQueryComponentPrepareContext

The 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.