Table of Contents

Class BulkInsertReturningBuilder<TEntity, TResult>

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Fluent terminal for a bulk insert that returns a projection (or the generated keys) of every written row through the provider's RETURNING/OUTPUT form, started with ReturningKey<TKey>() or Returning<TResult>(Expression<Func<TEntity, TResult>>).

This is the portable, batch path: the native bulk API cannot return rows, so the set is written as a sequence of returning INSERT ... VALUES statements. It requires a provider with RETURNING or OUTPUT (PostgreSQL, SQLite 3.35+, MariaDB 10.5+, SQL Server); MySQL and ClickHouse reject it with a clear NotSupportedException. The result order is not guaranteed to match the source order.

public sealed class BulkInsertReturningBuilder<TEntity, TResult>

Type Parameters

TEntity

The mapped entity type written.

TResult

The materialized row type.

Inheritance
BulkInsertReturningBuilder<TEntity, TResult>
Inherited Members
Extension Methods

Methods

ToList()

Writes every row and returns the materialized projection of each written row.

public IReadOnlyList<TResult> ToList()

Returns

IReadOnlyList<TResult>

The returned rows, in result-set order.

Exceptions

InvalidOperationException

No Values source was supplied, or the source is async.

NotSupportedException

The provider cannot express RETURNING/OUTPUT, or the context is read-only.

ToListAsync(CancellationToken)

Asynchronously writes every row and returns the materialized projection of each written row.

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

Parameters

cancellationToken CancellationToken

Cancels execution.

Returns

Task<IReadOnlyList<TResult>>

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

Exceptions

InvalidOperationException

No Values source was supplied.

NotSupportedException

The provider cannot express RETURNING/OUTPUT, or the context is read-only.

ToSql()

Renders the parameterised SQL this builder would execute for the first batch, without executing it. Useful for verifying the RETURNING/OUTPUT SQL without a database.

public string ToSql()

Returns

string

The rendered SQL text.

Exceptions

InvalidOperationException

No Values source was supplied, the source is empty, or it is async.

NotSupportedException

The provider cannot express RETURNING/OUTPUT, or the context is read-only.