Table of Contents

Class MutationCteQuery<TResult>

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Fluent scope that collects the declarations of a WITH clause whose body includes one data-modifying common table expression (an INSERT ... RETURNING), started with With<TEntity, TResult>(IDataContext, string, InsertReturningBuilder<TEntity, TResult>).

Only PostgreSQL accepts a data-modifying CTE body; every other provider rejects it. The scope is typed by the RETURNING projection (TResult), so From(string) reads the rows the mutation returns while FromTable(string) reads an ordinary read CTE declared alongside it.

public sealed class MutationCteQuery<TResult>

Type Parameters

TResult

The row shape the data-modifying CTE returns through RETURNING.

Inheritance
MutationCteQuery<TResult>
Inherited Members
Extension Methods

Properties

Ctes

Declarations collected so far, in declaration order.

public IReadOnlyList<CteDefinition> Ctes { get; }

Property Value

IReadOnlyList<CteDefinition>

Methods

From(string)

Starts a query whose source is the data-modifying CTE, so the rows the INSERT ... RETURNING produced can be filtered, joined and projected with the full operator set.

public EntityBuilder<TResult> From(string cteName)

Parameters

cteName string

The name of the data-modifying CTE.

Returns

EntityBuilder<TResult>

A typed builder over the returned rows.

Exceptions

ArgumentException

cteName is not the data-modifying CTE (use FromTable(string) for read CTEs).

FromTable(string)

Starts a query whose source is an ordinary read CTE declared alongside the mutation.

public EntityBuilder<TableAlias> FromTable(string cteName)

Parameters

cteName string

The name of the read CTE.

Returns

EntityBuilder<TableAlias>

A builder whose columns are read through TableAlias accessors.

With(string, QueryCommand)

Declares an additional non-recursive read CTE alongside the data-modifying one.

public MutationCteQuery<TResult> With(string name, QueryCommand query)

Parameters

name string

The name the CTE is declared under.

query QueryCommand

The query that defines the CTE.

Returns

MutationCteQuery<TResult>

A scope carrying every declaration, still typed by the mutation's projection.

WithRecursive(string, QueryCommand, int?)

Declares an additional recursive read CTE alongside the data-modifying one.

public MutationCteQuery<TResult> WithRecursive(string name, QueryCommand query, int? maxRecursion = null)

Parameters

name string

The name the CTE is declared under.

query QueryCommand

The query that defines the CTE.

maxRecursion int?

Optional recursion-depth limit.

Returns

MutationCteQuery<TResult>

A scope carrying every declaration, still typed by the mutation's projection.