Conflicts.ReadCurrentAsync<T> Method

Definition

Reads the item that originated the conflict.

public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ItemResponse<T>> ReadCurrentAsync<T> (Microsoft.Azure.Cosmos.ConflictProperties conflict, Microsoft.Azure.Cosmos.PartitionKey partitionKey, System.Threading.CancellationToken cancellationToken = default);
abstract member ReadCurrentAsync : Microsoft.Azure.Cosmos.ConflictProperties * Microsoft.Azure.Cosmos.PartitionKey * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.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

using (FeedIterator<ConflictProperties> conflictIterator = conflicts.GetConflictQueryIterator())
{
    while (conflictIterator.HasMoreResults)
    {
        foreach(ConflictProperties item in await conflictIterator.ReadNextAsync())
        {
            MyClass intendedChanges = conflicts.ReadConflictContent<MyClass>(item);
            ItemResponse<MyClass> currentState = await conflicts.ReadCurrentAsync<MyClass>(item, intendedChanges.MyPartitionKey);
        }
    }
}

Applies to

See also