Share via


AdapterExtensions.UseBotState(BotAdapter, BotState[]) Method

Definition

Adds middleware to the adapter to register one or more BotState objects on the turn context. The middleware registers the state objects on the turn context at the start of each turn.

public static Microsoft.Bot.Builder.BotAdapter UseBotState (this Microsoft.Bot.Builder.BotAdapter botAdapter, params Microsoft.Bot.Builder.BotState[] botStates);
static member UseBotState : Microsoft.Bot.Builder.BotAdapter * Microsoft.Bot.Builder.BotState[] -> Microsoft.Bot.Builder.BotAdapter
<Extension()>
Public Function UseBotState (botAdapter As BotAdapter, ParamArray botStates As BotState()) As BotAdapter

Parameters

botAdapter
BotAdapter

The adapter on which to register the state objects.

botStates
BotState[]

The state objects to register.

Returns

The updated adapter.

Remarks

To get the state objects, use the turn context's TurnState property's Get<T>(String) method, where the `key` parameter is the fully qualified name of the type of bot state to get.

Applies to