Condividi tramite


CosmosConflicts.ReadCurrentAsync<T> Method

Definition

Reads the item that originated the conflict.

public abstract System.Threading.Tasks.Task<Azure.Cosmos.ItemResponse<T>> ReadCurrentAsync<T> (Azure.Cosmos.ConflictProperties conflict, Azure.Cosmos.PartitionKey partitionKey, System.Threading.CancellationToken cancellationToken = default);
abstract member ReadCurrentAsync : Azure.Cosmos.ConflictProperties * Azure.Cosmos.PartitionKey * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Cosmos.ItemResponse<'T>>
Public MustOverride Function ReadCurrentAsync(Of T) (conflict As ConflictProperties, partitionKey As PartitionKey, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ItemResponse(Of T))

Type Parameters

T

Parameters

conflict
ConflictProperties

The conflict for which we want to read the item.

partitionKey
PartitionKey

The partition key for the item.

cancellationToken
CancellationToken

(Optional) CancellationToken representing request cancellation.

Returns

The current state of the item associated with the conflict.

Examples

await foreach(ConflictProperties item in conflicts.GetConflictsAsync())
{
    MyClass intendedChanges = conflicts.ReadConflictContent<MyClass>(item);
    ItemResponse<MyClass> currentState = await conflicts.ReadCurrentAsync<MyClass>(intendedChanges.MyPartitionKey, item);
}

Applies to

See also