Created
December 29, 2017 07:47
-
-
Save r4hulp/4ceaae42226f96bb9b345a55eadfad16 to your computer and use it in GitHub Desktop.
Retrieve user data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//In your dialog | |
Activity message = result as Activity; | |
//Create scope with respect to activity | |
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, message)) | |
{ | |
//Resolve scope for IBotDataStore<BotData> | |
IBotDataStore<BotData> stateStore = scope.Resolve<IBotDataStore<BotData>>(); | |
/* Retrieve user address. Address key holds information about Bot, Channel, User and conversation */ | |
Address key = Address.FromActivity(message); | |
//Load user data with the help of key | |
BotData userData = await stateStore.LoadAsync(key, BotStoreType.BotUserData, CancellationToken.None); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment