Method WriteStateAsync
- Namespace
- IntentSharp.Documents
- Assembly
- IntentSharp.dll
WriteStateAsync(string, JsonNode, string?, CancellationToken)
Writes a state value. With expectedEtag null the value is created or overwritten; otherwise it
is written only when the key's current etag is expectedEtag. Returns the entry as written, with
its new etag. To create a value only when the key has none, call TryCreateStateAsync(string, JsonNode, CancellationToken).
ValueTask<StateEntry> WriteStateAsync(string key, JsonNode value, string? expectedEtag, CancellationToken ct = default)
Parameters
keystringThe state key.
valueJsonNodeThe value to store; the store keeps a copy.
expectedEtagstringThe etag the key must have, from an earlier read or write; null to write regardless.
ctCancellationTokenCancels the call.
Returns
- ValueTask<StateEntry>
Exceptions
- ArgumentException
keyis null or blank.- ArgumentNullException
valueis null.- DocumentConflictException
expectedEtagis set and the key's current etag differs, or the key has no value. Nothing was written.