Share via


ITurnState.LoadStateAsync(ITurnContext, Boolean, CancellationToken) Method

Definition

Populates all states from the storage layer.

public System.Threading.Tasks.Task LoadStateAsync(Microsoft.Agents.Builder.ITurnContext turnContext, bool force = false, System.Threading.CancellationToken cancellationToken = default);
abstract member LoadStateAsync : Microsoft.Agents.Builder.ITurnContext * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function LoadStateAsync (turnContext As ITurnContext, Optional force As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

turnContext
ITurnContext

The context object for this turn.

force
Boolean

Optional, true to overwrite any existing state cache; or false to load state from storage only if the cache doesn't already exist.

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

turnContext is null.

Remarks

LoadAsync loads State for the specified turn.

Applies to