Class UpdateJoinReturningBuilder<TProjection, TResult>
Fluent terminal for a multi-table UPDATE that returns the updated rows through PostgreSQL's
UPDATE ... FROM ... RETURNING form, started with
Returning<TResult>(Expression<Func<TProjection, TResult>>).
The returned rows are materialised with the same projection pipeline as a query; every terminal reads
the result through Single() or ToList(). The same builder is also accepted as a
data-modifying CTE body by With<TProjection, TResult>(IDataContext, string, UpdateJoinReturningBuilder<TProjection, TResult>).
public sealed class UpdateJoinReturningBuilder<TProjection, TResult>
Type Parameters
TProjectionThe positional join projection (
Projection<T1, ...>).TResultThe materialized row type (the projection or a projection of it).
- Inheritance
-
UpdateJoinReturningBuilder<TProjection, TResult>
- Inherited Members
- Extension Methods
Methods
Single()
Executes the update and returns the single updated row.
public TResult Single()
Returns
- TResult
The materialized row.
Exceptions
- InvalidOperationException
The update touched no row, or more than one; use ToList().
- NotSupportedException
The provider cannot return updated rows from a multi-table update.
SingleAsync(CancellationToken)
Asynchronously executes the update and returns the single updated row.
public Task<TResult> SingleAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels execution.
Returns
- Task<TResult>
A task producing the materialized row.
Exceptions
- InvalidOperationException
The update touched no row, or more than one; use ToListAsync(CancellationToken).
- NotSupportedException
The provider cannot return updated rows from a multi-table update.
ToList()
Executes the update and returns every updated row.
public IReadOnlyList<TResult> ToList()
Returns
- IReadOnlyList<TResult>
The materialized rows, in result-set order.
Exceptions
- NotSupportedException
The provider cannot return updated rows from a multi-table update.
ToListAsync(CancellationToken)
Asynchronously executes the update and returns every updated row.
public Task<IReadOnlyList<TResult>> ToListAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels execution.
Returns
- Task<IReadOnlyList<TResult>>
A task producing the materialized rows, in result-set order.
Exceptions
- NotSupportedException
The provider cannot return updated rows from a multi-table update.
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 update.