IReliableDictionary<TKey,TValue>.AddAsync Method

Definition

Overloads

AddAsync(ITransaction, TKey, TValue)

Adds the specified key/value pair to the Reliable Dictionary.

AddAsync(ITransaction, TKey, TValue, TimeSpan, CancellationToken)

Adds the specified key/value pair to the Reliable Dictionary.

AddAsync(ITransaction, TKey, TValue)

Adds the specified key/value pair to the Reliable Dictionary.

public System.Threading.Tasks.Task AddAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, TValue value);
abstract member AddAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * 'Value -> System.Threading.Tasks.Task
Public Function AddAsync (tx As ITransaction, key As TKey, value As TValue) As Task

Parameters

tx
ITransaction

Transaction to associate this operation with.

key
TKey

The key to be added.

value
TValue

The value to be added. The value can be null for reference types.

Returns

System.Threading.Tasks.Task

A task that represents the asynchronous add operation.

Exceptions

System.ArgumentNullException

tx is null, or key is null or cannot be serialized.

System.ArgumentException

A value with the same key already exists in the Reliable Dictionary.

System.TimeoutException

The operation failed to complete within the default timeout.

The exception that is thrown when the IReliableDictionary<TKey,TValue> is not in Primary.

The transaction has been internally faulted by the system. Retry the operation on a new transaction

System.InvalidOperationException

Thrown when a method call is invalid for the object's current state. Example, transaction used is already terminated: committed or aborted by the user. If this exception is thrown, it is highly likely that there is a bug in the service code of the use of transactions.

Indicates that the Reliable Dictionary is closed or deleted.

Applies to

AddAsync(ITransaction, TKey, TValue, TimeSpan, CancellationToken)

Adds the specified key/value pair to the Reliable Dictionary.

public System.Threading.Tasks.Task AddAsync (Microsoft.ServiceFabric.Data.ITransaction tx, TKey key, TValue value, TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
abstract member AddAsync : Microsoft.ServiceFabric.Data.ITransaction * 'Key * 'Value * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

tx
ITransaction

Transaction to associate this operation with.

key
TKey

The key to be added.

value
TValue

The value to be added. The value can be null for reference types.

timeout
System.TimeSpan

The amount of time to wait for the operation to complete before throwing a TimeoutException. Primarily used to prevent deadlocks. The default is 4 seconds.

cancellationToken
System.Threading.CancellationToken

The token to monitor for cancellation requests. The default is None.

Returns

System.Threading.Tasks.Task

A task that represents the asynchronous add operation.

Exceptions

System.ArgumentNullException

tx is null, or key is null or cannot be serialized.

System.ArgumentException

A value with the same key already exists in the Reliable Dictionary, or timeout is negative.

System.TimeoutException

The operation failed to complete within the given timeout.

System.OperationCanceledException

The operation was canceled.

The exception that is thrown when the IReliableDictionary<TKey,TValue> is not in Primary.

The transaction has been internally faulted by the system. Retry the operation on a new transaction

System.InvalidOperationException

Thrown when a method call is invalid for the object's current state. Example, transaction used is already terminated: committed or aborted by the user. If this exception is thrown, it is highly likely that there is a bug in the service code of the use of transactions.

Indicates that the Reliable Dictionary is closed or deleted.

Applies to