Class SelectGroupExtensions
- Namespace
- NextORM.Extensions
- Assembly
- nextorm.extensions.dll
The grouping operators of the nextorm.extensions package: SelectGroup and
SelectGroupHaving, both built on the public query-component contract.
public static class SelectGroupExtensions
- Inheritance
-
SelectGroupExtensions
- Inherited Members
Methods
SelectGroupHaving<TEntity, TResult>(EntityBuilder<TEntity>, Expression<Func<TEntity, TResult>>, Expression<Func<TResult, bool>>)
Same inference as SelectGroup<TEntity, TResult>(EntityBuilder<TEntity>, Expression<Func<TEntity, TResult>>), with condition
AND-ed into the effective HAVING. The condition is typed on the projection result
(TResult), never on the source entity: a member of the result stands for the
projection expression that produces it, so f => f.Total > 5 becomes the same HAVING as
the underlying sum(...) > 5. Keys are inferred only from projection;
the condition never adds a key.
public static QueryCommand<TResult> SelectGroupHaving<TEntity, TResult>(this EntityBuilder<TEntity> source, Expression<Func<TEntity, TResult>> projection, Expression<Func<TResult, bool>> condition)
Parameters
sourceEntityBuilder<TEntity>The entity builder to group.
projectionExpression<Func<TEntity, TResult>>The same projection lambda
Selecttakes.conditionExpression<Func<TResult, bool>>A
HAVINGpredicate over the projection result, AND-ed with any existing sourceHaving.
Returns
- QueryCommand<TResult>
A typed command for the grouped projection.
Type Parameters
TEntityThe mapped source entity.
TResultThe shape of the projection.
Exceptions
- ArgumentNullException
projectionorconditionis null.- QueryPreparationException
The command already carries explicit grouping, the projection contains a window function or a subquery, the condition references a member the projection does not bind (or the result as a whole), or a row member of the projection or of the effective
HAVINGis not covered by an inferred key.- NotSupportedException
The command targets the in-memory provider.
SelectGroup<TEntity, TResult>(EntityBuilder<TEntity>, Expression<Func<TEntity, TResult>>)
Projects each group of source, inferring the GROUP BY keys from
projection: every aggregate-free, row-dependent subexpression becomes a key and
the aggregate calls fold each group. The projection keeps its exact shape — no client-side grouping
and no rewriting of its members.
public static QueryCommand<TResult> SelectGroup<TEntity, TResult>(this EntityBuilder<TEntity> source, Expression<Func<TEntity, TResult>> projection)
Parameters
sourceEntityBuilder<TEntity>The entity builder to group.
projectionExpression<Func<TEntity, TResult>>The same projection lambda
Selecttakes.
Returns
- QueryCommand<TResult>
A typed command for the grouped projection.
Type Parameters
TEntityThe mapped source entity.
TResultThe shape of the projection.
Exceptions
- ArgumentNullException
projectionis null.- QueryPreparationException
The command already carries explicit grouping, the projection contains a window function or a subquery, or a
Having/expressionOrderBymember is not covered by an inferred key.- NotSupportedException
The command targets the in-memory provider.