예제 #1
0
 /// <summary>Runs a transactional lambda function against this database, inside a read-write transaction context, with retry logic.</summary>
 /// <param name="handler">Asynchronous lambda function that is passed a new read-write transaction on each retry. The result of the task will also be the result of the transactional.</param>
 /// <param name="success">Will be called at most once, and only if the transaction commits successfully. Any exception or crash that happens right after the commit may cause this callback not NOT be called, even if the transaction has committed!</param>
 /// <param name="ct">Optional cancellation token that will be passed to the transaction context, and that can also be used to abort the retry loop.</param>
 public Task <TResult> ReadWriteAsync <TIntermediate, TResult>([InstantHandle] Func <IFdbTransaction, Task <TIntermediate> > handler, [InstantHandle] Func <IFdbTransaction, TIntermediate, Task <TResult> > success, CancellationToken ct)
 {
     return(FdbOperationContext.RunWriteWithResultAsync <TIntermediate, TResult>(this, handler, success, ct));
 }
예제 #2
0
 /// <summary>Runs a transactional lambda function against this database, inside a read-write transaction context, with retry logic.</summary>
 /// <param name="handler">Asynchronous lambda function that is passed a new read-write transaction on each retry. The result of the task will also be the result of the transactional.</param>
 /// <param name="ct">Optional cancellation token that will be passed to the transaction context, and that can also be used to abort the retry loop.</param>
 public Task <TResult> ReadWriteAsync <TResult>([InstantHandle] Func <IFdbTransaction, TResult> handler, CancellationToken ct)
 {
     return(FdbOperationContext.RunWriteWithResultAsync <TResult>(this, handler, ct));
 }
예제 #3
0
 /// <summary>Runs a transactional lambda function against this database, inside a read-write transaction context, with retry logic.</summary>
 /// <param name="state">State that will be passed back to the <paramref name="handler"/></param>
 /// <param name="handler">Asynchronous lambda function that is passed a new read-write transaction on each retry. The result of the task will also be the result of the transactional.</param>
 /// <param name="ct">Optional cancellation token that will be passed to the transaction context, and that can also be used to abort the retry loop.</param>
 public Task <TResult> ReadWriteAsync <TState, TResult>(TState state, [InstantHandle] Func <IFdbTransaction, TState, Task <TResult> > handler, CancellationToken ct)
 {
     Contract.NotNull(handler, nameof(handler));
     return(FdbOperationContext.RunWriteWithResultAsync <TResult>(this, (tr) => handler(tr, state), ct));
 }
 /// <summary>EXPERIMENTAL</summary>
 public Task <R> ReadWriteAsync <R>([InstantHandle] Func <IFdbTransaction, Task <R> > asyncHandler, [InstantHandle] Action <IFdbTransaction> onDone, CancellationToken cancellationToken)
 {
     return(FdbOperationContext.RunWriteWithResultAsync <R>(this, asyncHandler, onDone, cancellationToken));
 }