Table of Contents

Class QueryDefinition

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Describes the shape of a QueryCommand: the projection/entity source, the condition, joins, paging, ordering, grouping and logging. It groups the collaborators that used to travel as a long constructor parameter list through QueryCommand, QueryCommand<TResult> and CreateCommand.

public sealed record QueryDefinition : IEquatable<QueryDefinition>
Inheritance
QueryDefinition
Implements
Inherited Members
Extension Methods

Remarks

Immutable; use with to derive a variant (for example a re-ordered clone). Exactly one of Exp or SrcType identifies the source: Exp is the projection lambda for the generic command, SrcType the entity type when there is no projection.

Properties

Condition

Optional predicate applied as a WHERE clause.

public LambdaExpression? Condition { get; init; }

Property Value

LambdaExpression

Exp

Projection lambda of the query, or null when SrcType is used.

public LambdaExpression? Exp { get; init; }

Property Value

LambdaExpression

Final

Whether the query carries the ClickHouse FINAL modifier.

public bool Final { get; init; }

Property Value

bool

Group

Optional grouping lambda.

public LambdaExpression? Group { get; init; }

Property Value

LambdaExpression

GroupByWithTotals

Whether the grouping carries the WITH TOTALS modifier (ClickHouse).

public bool GroupByWithTotals { get; init; }

Property Value

bool

Having

Optional HAVING lambda.

public LambdaExpression? Having { get; init; }

Property Value

LambdaExpression

IgnoreFilters

Whether the query disables any global query filter declared for its entity type, either through the all-or-nothing form or a selective NextORM.Core.QueryDefinition.FilterScope. Only a fallback for a definition that carries no NextORM.Core.QueryDefinition.FilterScope: with true it means every filter is disabled.

public bool IgnoreFilters { get; init; }

Property Value

bool

IsDistinct

Whether the query was marked DISTINCT.

public bool IsDistinct { get; init; }

Property Value

bool

Joins

Joins accumulated by the builder.

public JoinExpression[]? Joins { get; init; }

Property Value

JoinExpression[]

Logger

Whether the projection was declared through SelectGroup, so the grouping keys are inferred from the projection's scalar outputs instead of a Group lambda.

public ILogger? Logger { get; init; }

Property Value

ILogger

Paging

Paging (limit/offset) applied to the query.

public Paging Paging { get; init; }

Property Value

Paging

PreWhere

Optional ClickHouse PREWHERE predicate.

public LambdaExpression? PreWhere { get; init; }

Property Value

LambdaExpression

SampleOffset

The ClickHouse SAMPLE ... OFFSET value; zero when absent.

public double SampleOffset { get; init; }

Property Value

double

SampleRatio

The ClickHouse SAMPLE ratio, or null when the modifier is absent.

public double? SampleRatio { get; init; }

Property Value

double?

Settings

The trailing ClickHouse SETTINGS entries, or null when there are none.

public IReadOnlyList<KeyValuePair<string, string>>? Settings { get; init; }

Property Value

IReadOnlyList<KeyValuePair<string, string>>

Sorting

Ordering accumulated by the builder.

public Sorting[]? Sorting { get; init; }

Property Value

Sorting[]

SrcType

Entity type of the query when there is no projection lambda.

public Type? SrcType { get; init; }

Property Value

Type

Windows

Named window definitions declared for this query (WINDOW w AS (...)), or null when the query declares none. A dialect that does not support the clause rejects a query that carries them.

public IReadOnlyList<WindowDefinition>? Windows { get; init; }

Property Value

IReadOnlyList<WindowDefinition>

Methods

ForEntity(Type)

Creates a definition whose source is the given entity type (no projection lambda).

public static QueryDefinition ForEntity(Type entityType)

Parameters

entityType Type

Returns

QueryDefinition

ForProjection(LambdaExpression)

Creates a definition whose source is the given projection lambda.

public static QueryDefinition ForProjection(LambdaExpression exp)

Parameters

exp LambdaExpression

Returns

QueryDefinition