public static BotAdapter UseState(this BotAdapter botAdapter, UserState userState, ConversationState conversationState, bool auto = true) { if (botAdapter == null) { throw new ArgumentNullException(nameof(botAdapter)); } if (userState == null) { throw new ArgumentNullException(nameof(userState)); } if (conversationState == null) { throw new ArgumentNullException(nameof(conversationState)); } botAdapter.Use(new RegisterClassMiddleware <UserState>(userState)); botAdapter.Use(new RegisterClassMiddleware <ConversationState>(conversationState)); if (auto) { return(botAdapter.Use(new AutoSaveStateMiddleware(userState, conversationState))); } return(botAdapter); }
public StateManagementBot(Microsoft.Bot.Builder.ConversationState conversationState, UserState userState) { ConversationState = conversationState; UserState = userState; }
public InspectionMiddleware(InspectionState inspectionState, UserState userState = null, ConversationState conversationState = null, MicrosoftAppCredentials credentials = null, ILogger <InspectionMiddleware> logger = null) : base(logger) { _inspectionState = inspectionState ?? throw new ArgumentNullException(nameof(inspectionState)); _userState = userState; _conversationState = conversationState; _credentials = credentials ?? MicrosoftAppCredentials.Empty; _httpClient = new Lazy <HttpClient>(() => new HttpClient()); }