Amazon DynamoDB · Types · Other public types

ArxBatchDataServiceExtensions

Definition

Namespace
ARX.SDK.Services
Package
ARX.SDK
C#
public static class ArxBatchDataServiceExtensions

Batch-scope helpers shared by every provider.

Methods

  • static Task RunBatchAsync(this IArxBatchDataService service, Func<IArxBatchScope, Task> body, ArxBatchOptions? options = null, CancellationToken cancellationToken = default)

    Runs body in a new batch scope with automatic commit: the scope is committed when the body returns, and rolled back if it throws, whether an ARX call or the developer's own code failed. The exception is rethrown unchanged. A failure the body catches itself doesn't stop the commit when savepoints undid that call alone (the rest is kept). When the failed call rolled the whole scope back instead (no savepoints: MongoDB, DynamoDB, or Savepoints = false), nothing was kept, so RunBatchAsync throws ARX1015 TransactionAborted when the body returns rather than return as if the work were saved. A body that commits or rolls back itself ends the scope, and nothing more is done.

    Parameter Type Description
    servicethis IArxBatchDataServiceThe service that opens the scope.
    bodyFunc<IArxBatchScope, Task>The scope's work: every call it makes on the scope runs in one transaction, committed when it returns.
    optionsArxBatchOptions?= nullThe scope's options; null for the defaults (no savepoints).
    cancellationTokenCancellationToken= defaultCancels the call.
  • static Task<T> RunBatchAsync<T>(this IArxBatchDataService service, Func<IArxBatchScope, Task<T>> body, ArxBatchOptions? options = null, CancellationToken cancellationToken = default)

    As RunBatchAsync, for a body that returns a value (the ids it created, a count): the value is returned once the scope is committed.

    Parameter Type Description
    servicethis IArxBatchDataServiceThe service that opens the scope.
    bodyFunc<IArxBatchScope, Task<T>>The scope's work: every call it makes on the scope runs in one transaction, committed when it returns.
    optionsArxBatchOptions?= nullThe scope's options; null for the defaults (no savepoints).
    cancellationTokenCancellationToken= defaultCancels the call.