Table of Contents

Class DeleteJoinReturningBuilder<TProjection, TResult>

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Fluent terminal for a multi-table DELETE that returns the removed rows through PostgreSQL's DELETE ... USING ... RETURNING form, started with CreateDeleteJoinBuilder<T1, T2>(JoinedEntityBuilder<T1, T2>) and switched to a returning selector with Returning<TResult>(Expression<Func<TProjection, TResult>>). The whole-projection (identity) form returns every returnable mapped property of every item slot, in slot order, so a self-join of one type keeps its Item1/Item2 values distinct (a repeated CLR type stays separated by slot); explicit projections are unchanged and no call adds a RETURNING list implicitly. The returned rows are materialised with the same projection pipeline as a query; every terminal reads the result through Single() or ToList(). Identity is PostgreSQL only, on INNER joins and for arities 2–8; every other provider and every outer join rejects. The same builder is also accepted as a data-modifying CTE body by With<TProjection, TResult>(IDataContext, string, DeleteJoinReturningBuilder<TProjection, TResult>).

public sealed class DeleteJoinReturningBuilder<TProjection, TResult>

Type Parameters

TProjection

The positional join projection (Projection<T1, ...>).

TResult

The materialized row type (the projection or a projection of it).

Inheritance
DeleteJoinReturningBuilder<TProjection, TResult>
Inherited Members
Extension Methods

Methods

Single()

Executes the delete and returns the single removed row.

public TResult Single()

Returns

TResult

The materialized row.

Exceptions

InvalidOperationException

The delete removed no row, or more than one; use ToList().

NotSupportedException

The provider cannot return removed rows from a multi-table delete.

SingleAsync(CancellationToken)

Asynchronously executes the delete and returns the single removed row.

public Task<TResult> SingleAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels execution.

Returns

Task<TResult>

A task producing the materialized row.

Exceptions

InvalidOperationException

The delete removed no row, or more than one; use ToListAsync(CancellationToken).

NotSupportedException

The provider cannot return removed rows from a multi-table delete.

ToList()

Executes the delete and returns every removed row.

public IReadOnlyList<TResult> ToList()

Returns

IReadOnlyList<TResult>

The materialized rows, in result-set order.

Exceptions

NotSupportedException

The provider cannot return removed rows from a multi-table delete.

ToListAsync(CancellationToken)

Asynchronously executes the delete and returns every removed row.

public Task<IReadOnlyList<TResult>> ToListAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels execution.

Returns

Task<IReadOnlyList<TResult>>

A task producing the materialized rows, in result-set order.

Exceptions

NotSupportedException

The provider cannot return removed rows from a multi-table delete.

ToSql()

Renders the parameterised SQL this builder would execute, without executing it. Useful for diagnostics and for verifying SQL generation without a database.

public string ToSql()

Returns

string

The rendered SQL text.

Exceptions

NotSupportedException

The context is not database-backed, or the provider cannot return rows from a multi-table delete.