Share via


BotState.LoadAsync(ITurnContext, Boolean, CancellationToken) Method

Definition

Populates the state cache for this BotState from the storage layer.

public virtual System.Threading.Tasks.Task LoadAsync (Microsoft.Bot.Builder.ITurnContext turnContext, bool force = false, System.Threading.CancellationToken cancellationToken = default);
abstract member LoadAsync : Microsoft.Bot.Builder.ITurnContext * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.LoadAsync : Microsoft.Bot.Builder.ITurnContext * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function LoadAsync (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.

Applies to