Class DeleteJoinBuilder<TProjection>
Fluent starter for the row-returning form of a multi-table DELETE, produced by
CreateDeleteJoinBuilder<T1, T2>(JoinedEntityBuilder<T1, T2>). It
switches an already-built joined query to the returning terminal through Returning() or
Returning<TResult>(Expression<Func<TProjection, TResult>>); the target is the first table of the join chain and the removed-row
values come from every joined table the selector reads. 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).
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 through With<TProjection, TResult>(IDataContext, string, DeleteJoinReturningBuilder<TProjection, TResult>).
public sealed class DeleteJoinBuilder<TProjection>
Type Parameters
TProjectionThe positional join projection (
Projection<T1, ...>).
- Inheritance
-
DeleteJoinBuilder<TProjection>
- Inherited Members
- Extension Methods
Methods
Returning()
Switches the builder to the whole-projection (identity) row-returning terminal: every returnable
mapped property of every item slot is returned, in slot order, so a self-join of one type keeps its
Item1/Item2 values distinct (a repeated CLR type stays separated by slot). Equivalent
to Returning(p => p). The removed rows carry the deleted-row values, and the builder can be
consumed directly or as a data-modifying CTE body through With(name, delete). Returned
columns get deterministic per-slot aliases; explicit projections are unchanged and no call adds a
RETURNING list implicitly.
PostgreSQL only, on INNER joins and for arities 2–8; every other provider and every outer join rejects. A returned item whose mapped property is a multi-column Range<T> is rejected, as is a required member with no counterpart in the joined source shape.
public DeleteJoinReturningBuilder<TProjection, TProjection> Returning()
Returns
- DeleteJoinReturningBuilder<TProjection, TProjection>
A returning builder whose terminals produce the full
TProjection.
Exceptions
- NotSupportedException
A returned mapped property is a multi-column Range<T>, or the provider/join is unsupported.
- QueryPreparationException
A returned item slot has no registered entity metadata and exposes no readable columns.
Returning<TResult>(Expression<Func<TProjection, TResult>>)
Switches the builder to a row-returning terminal that materialises a projection of the removed rows
through PostgreSQL's DELETE ... USING ... RETURNING form. A selected member may reference any
joined table (for example Returning(p => new { p.Item1.Id, p.Item2.Name })). Only
PostgreSQL supports returning rows from a multi-table delete; every other provider rejects it.
public DeleteJoinReturningBuilder<TProjection, TResult> Returning<TResult>(Expression<Func<TProjection, TResult>> projection)
Parameters
projectionExpression<Func<TProjection, TResult>>Selects the mapped columns to return.
Returns
- DeleteJoinReturningBuilder<TProjection, TResult>
A returning builder whose terminals produce
TResult.
Type Parameters
TResultThe projected row shape.
Exceptions
- ArgumentNullException
projectionis null.- NotSupportedException
The projection references something other than mapped properties.