Sprog

IStorageV2.WriteAsync<TValue> Method

Definition

Writes typed items to storage and returns an explicit result for each requested write.

public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<string,Microsoft.Agents.Storage.StorageWriteResult>> WriteAsync<TValue>(System.Collections.Generic.IReadOnlyDictionary<string,TValue> changes, Microsoft.Agents.Storage.StorageWriteOptions options, System.Threading.CancellationToken cancellationToken = default) where TValue : class;
abstract member WriteAsync : System.Collections.Generic.IReadOnlyDictionary<string, 'Value (requires 'Value : null)> * Microsoft.Agents.Storage.StorageWriteOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<string, Microsoft.Agents.Storage.StorageWriteResult>> (requires 'Value : null)
Public Function WriteAsync(Of TValue As Class) (changes As IReadOnlyDictionary(Of String, TValue), options As StorageWriteOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IReadOnlyDictionary(Of String, StorageWriteResult))

Type Parameters

TValue

The value type to write.

Parameters

changes
IReadOnlyDictionary<String,TValue>

The keyed, non-null items to write.

options
StorageWriteOptions

Settings for the V2 write operation.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

A task that represents the work queued to execute.

Exceptions

The changes collection is null.

An item value in the changes collection is null. The batch is rejected before any item is written.

Remarks

V2 writes must pass options explicitly. Use ExpectedVersion for optimistic concurrency. Calls without options use the inherited IStorage contract and preserve payload ETag checks. Null item values are not supported; use an explicit delete operation to remove a key.

Applies to