Documentation
Table of Contents

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

store IDocumentStore

The store that holds the document.

id DocumentId

The document to revert.

ct CancellationToken

Cancels the call.

Returns

ValueTask<DocumentVersion>

Exceptions

ArgumentNullException

store is 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.