Share via


AdapterExtensions.UseState 方法

定义

注意

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

向适配器注册用户和会话状态对象。 这些对象将通过轮次上下文的 TurnState.Get<T>() 方法提供。

[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

参数

botAdapter
BotAdapter

BotAdapter 对其注册对象的 。

userState
UserState

要注册的 UserState 对象。

conversationState
ConversationState

要注册的 ConversationState 对象。

auto
Boolean

true 如果为 ,则自动保留每个轮次的状态;否则为 false。 如果为 false,则负责保留每个轮次的状态。

返回

更新的适配器。

属性

注解

这将添加 IMiddleware 以注册用户和聊天状态管理对象。 如果 auto 为 true,则还会添加中间件以在每次轮次结束前自动保存状态。

适用于