SQL Server · Types · Services and connections
ArxBatchOptions
Definition
- Namespace
ARX.SDK.Services- Package
ARX.SDK
public sealed class ArxBatchOptionsOptions for a batch scope.
Properties
bool? Savepoints { get; init; }When true, each call made through the scope runs inside its own savepoint. A failed call is then undone alone: the calls before it stay in the transaction, the scope stays
Active, and the developer decides whether to continue, retry or roll back. When false or null (the default), any failed call rolls back the whole scope, on every provider, so the same code ends the same way on every database: a body that catches the error has nothing saved, andRunBatchAsyncthrows ARX1015 when it returns. Ask for savepoints where a failed call should be undone alone; only PostgreSQL, SQL Server and MySQL have them (Savepoints), and true on MongoDB or DynamoDB is refused withArxNotSupportedException.
Usage
A line from a verified sample; the full, runnable code is on its page.
await using (var scope = await dbContext.Service.BeginBatchAsync(new ArxBatchOptions { Savepoints = true }))Import 5,000 contacts in batches, in one transaction, scenario 2
Used in:
- Import 5,000 contacts in batches, in one transactionCreateMultiple
- Stock counts in batches: one transaction, a failed batch skippedUpdateMultiple
- Read in a batch scopeRetrieveMultiple
- Execute in a batch scope: a refused call undone aloneExecute