Method RevertAsync
- Namespace
- IntentSharp.Documents
- Assembly
- IntentSharp.dll
RevertAsync(IDocumentStore, DocumentId, CancellationToken)
Reverts a document to the version that was running before the current one: the version, other than the running one and not rejected, that became running most recently (the greatest LastActivatedAt). That is not always the previous sequence: after activating versions 1, 3 and then 2, a revert returns to 3. The revert is an activation, so it fires the document's change tokens like any edit. Returns the version now running.
public static ValueTask<DocumentVersion> RevertAsync(this IDocumentStore store, DocumentId id, CancellationToken ct = default)
Parameters
storeIDocumentStoreThe store that holds the document.
idDocumentIdThe document to revert.
ctCancellationTokenCancels the call.
Returns
- ValueTask<DocumentVersion>
Exceptions
- ArgumentNullException
storeis null.- ArgumentException
A default DocumentId, which names no document.
- InvalidOperationException
No version other than the running one has ever been running, or every such version is rejected.