Jaa


AdapterExtensions.UseState Method

Definition

Caution

This method is deprecated in 4.9. You should use the method .UseBotState() instead.

Registers user and conversation state objects with the adapter. These objects will be available via the turn context's TurnState.Get<T>() method.

[System.Obsolete("This method is deprecated in 4.9.  You should use the method .UseBotState() instead.")]
public static Microsoft.Bot.Builder.BotAdapter UseState (this Microsoft.Bot.Builder.BotAdapter botAdapter, Microsoft.Bot.Builder.UserState userState, Microsoft.Bot.Builder.ConversationState conversationState, bool auto = true);
[<System.Obsolete("This method is deprecated in 4.9.  You should use the method .UseBotState() instead.")>]
static member UseState : Microsoft.Bot.Builder.BotAdapter * Microsoft.Bot.Builder.UserState * Microsoft.Bot.Builder.ConversationState * bool -> Microsoft.Bot.Builder.BotAdapter
<Extension()>
Public Function UseState (botAdapter As BotAdapter, userState As UserState, conversationState As ConversationState, Optional auto As Boolean = true) As BotAdapter

Parameters

botAdapter
BotAdapter

The BotAdapter on which to register the objects.

userState
UserState

The UserState object to register.

conversationState
ConversationState

The ConversationState object to register.

auto
Boolean

true to automatically persist state each turn; otherwise, false. When false, it is your responsibility to persist state each turn.

Returns

The updated adapter.

Attributes

Remarks

This adds IMiddleware to register the user and conversation state management objects. If auto is true, this also adds middleware to automatically persist state before each turn ends.

Applies to