Dela via


IReliableStateManager.TryGetAsync Method

Definition

Overloads

TryGetAsync<T>(String)

Attempts to get an IReliableState of the given type T and with the given name.

TryGetAsync<T>(Uri)

Attempts to get an IReliableState of the given type T and with the given name.

TryGetAsync<T>(String)

Attempts to get an IReliableState of the given type T and with the given name.

public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryGetAsync<T> (string name) where T : Microsoft.ServiceFabric.Data.IReliableState;
abstract member TryGetAsync : string -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>> (requires 'T :> Microsoft.ServiceFabric.Data.IReliableState)
Public Function TryGetAsync(Of T As IReliableState) (name As String) As Task(Of ConditionalValue(Of T))

Type Parameters

T

When specifying the type, you may ask for either a concrete type or an interface type. The retrieved object will be cast to the given type.

Parameters

name
String

The name of the IReliableState. This name must be unique in this IReliableStateManager across IReliableState types, including unrelated types.

Returns

Task that represents the asynchronous operation. The task result is a tuple indicating whether the reliable state was found, and if so the instance.

Exceptions

name is null.

The IReliableState instance is not convertible to type T.

Exception indicates that the State Manager cannot retrive a reliable collection. FabricNotReadableException can be thrown in all ReplicaRoles. For example, when a Primary or ActiveSecondary looses ReadStatus.

Indicates that the Reliable State Manager is closed.

The operation has been internally faulted by the system. Retry the operation

Applies to

TryGetAsync<T>(Uri)

Attempts to get an IReliableState of the given type T and with the given name.

public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryGetAsync<T> (Uri name) where T : Microsoft.ServiceFabric.Data.IReliableState;
abstract member TryGetAsync : Uri -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>> (requires 'T :> Microsoft.ServiceFabric.Data.IReliableState)
Public Function TryGetAsync(Of T As IReliableState) (name As Uri) As Task(Of ConditionalValue(Of T))

Type Parameters

T

When specifying the type, you may ask for either a concrete type or an interface type. The retrieved object will be cast to the given type.

Parameters

name
Uri

The name of the IReliableState. This name must be unique in this IReliableStateManager across IReliableState types, including unrelated types.

Returns

Task that represents the asynchronous operation. The task result is a tuple indicating whether the reliable state was found, and if so the instance.

Exceptions

name is null.

The IReliableState instance is not convertible to type T.

Exception indicates that the State Manager cannot retrive a reliable collection. FabricNotReadableException can be thrown in all ReplicaRoles. For example, when a Primary or ActiveSecondary looses ReadStatus.

Indicates that the Reliable State Manager is closed.

The operation has been internally faulted by the system. Retry the operation

Applies to