Method RollbackAsync
RollbackAsync(CancellationToken)
Rolls back the transaction, discarding the files it added and abandoning the deletions it made.
Declaration
Task RollbackAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A cancellation token that cancels the operation. |
Returns
| Type | Description |
|---|---|
| Task |
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 a cleanup pass to resolve (see IFileRepoTransaction). 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.
A failure to roll back an individual file is not thrown: the file stays accessible in an indeterminate state for the next cleanup pass to resolve, and the failure is reported through TransactionCompletionFailed.