How to get chat history from azure table storage

Since we are forced to drop the client state and go to the user repository, in my case it is an Azure table repository . Using my storageexplorer, I see that it already saved the conversation data on my azure. How can I update my ff code to get chat history? I used to use the IActivityLogger class to record a conversation, but now I'm not sure how to update it.

Global Asax before:

protected void Application_Start() { var builder = new ContainerBuilder(); builder.RegisterType<Logger>().AsImplementedInterfaces().InstancePerDependency(); builder.Update(Conversation.Container); GlobalConfiguration.Configure(WebApiConfig.Register); } 

Global Asax after:

 protected void Application_Start() { Conversation.UpdateContainer(builder => { builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly())); var store = new TableBotDataStore(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString); builder.Register(c => store) .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore) .AsSelf() .SingleInstance(); }); GlobalConfiguration.Configure(WebApiConfig.Register); } 

Logger Class:

 public class Logger:IActivityLogger { public static ConcurrentDictionary<string, List<IActivity>> Messages = new ConcurrentDictionary<string, List<IActivity>>(); public Task LogAsync(IActivity activity) { try { var list = new List<IActivity>() { activity }; Messages.AddOrUpdate(activity.Conversation.Id, list, (k, v) => { v.Add(activity); return v; }); return Task.FromResult(false); } catch (System.Exception) { throw; } } } 

Here's how I use it (how can I update the stateclient part and use my storage on Azure ?:

 var reply = activity.CreateReply(); var storedActivities = new List<IActivity>(); var found = Logger.Messages.TryGetValue(activity.Conversation.Id, out storedActivities); if (storedActivities != null) { foreach (var storedActivity in storedActivities) { reply.Text += $" <br /> <b>{storedActivity.From.Name}:</b> {storedActivity.AsMessageActivity().Text}"; } // Get any saved values StateClient sc = activity.GetStateClient(); BotData userData = sc.BotState.GetPrivateConversationData( activity.ChannelId, activity.Conversation.Id, activity.From.Id); var UserEmail = userData.GetProperty<string>("Email"); var Name = userData.GetProperty<string>("Name"); } 

They gave a new Tablelogger class. Unfortunately, I do not know how to consume it. TableLogger.cs

+9
c # azure-storage azure-table-storage chatbot botframework
source share

No one has answered this question yet.

See similar questions:

3
How to get saved conversation data in Azure (Tablelogger)
2
How can I access the dialog boxes of the Bot Framework dialog box?

or similar:

2058
How to get consistent byte representation of strings in C # without manually specifying an encoding?
1658
Get int value from enum in C #
1266
How to update GUI from another thread?
774
Get property value from string using reflection in C #
111
Azure table storage returns 400 Bad Request
44
Azure and SQL Storage Tables
35
How to make an asynchronous Azure table storage query? client version 4.0.1
5
Retry 408 Timeout from Azure Table Storage Service
3
Azure Storage Tables - Entity Version History
one
Table design in azure storage table

All Articles