Method RollbackAsync
RollbackAsync(CancellationToken)
Rolls back the transaction, discarding any file additions or deletions made during the transaction.
Declaration
public Task RollbackAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Implements
Remarks
The files the transaction added are deleted now, and the files it deleted stay in the repository as if the transaction had not deleted them. Rolling back is how an application that knows that its database did not commit discards the transaction's files at once: disposing the transaction without rolling it back does not discard them but leaves them indeterminate for the cleaner to resolve (see DisposeAsync()). Do not roll back once the database commit has been attempted and its outcome is not known, or files that a committed row references are deleted.
Failures to roll back individual files are not thrown: they are reported through TransactionCompletionFailed, and the affected files are left for the cleaner. If the repository cannot be accessed, the rollback waits for it for up to MaxAccessWaitOrRetryTime once for all of its files, as CommitAsync(CancellationToken) does.