Saving Bot Activities in Azure SQL Database not working.
I am working on new bot feature to save the bot activities in azure data base. I have done all the required configuration as mentioned on the bot framework web site https://blog.botframework.com/2017/05/05/Saving-Bot-Actions-On-Azure-Sql-Server/. If I send the message from emulator it was failing and throwing the error message.
Looks the below code functionality is incomplete. I think LogAsync function is return null because of that application is throwing null reference error. Could you please help me to fix this issue.
public class EntityFrameworkActivityLogger : IActivityLogger
{
Task IActivityLogger.LogAsync(IActivity activity)
{
IMessageActivity msg = activity.AsMessageActivity();
using (Data.ConversationDataContext dataContext = new Data.ConversationDataContext())
{
var newActivity = Mapper.Map<IMessageActivity, Data.Activity>(msg);
if (string.IsNullOrEmpty(newActivity.Id))
newActivity.Id = Guid.NewGuid().ToString();
dataContext.Activities.Add(newActivity);
dataContext.SaveChanges();
}
return null;
}
}
Try
return Task.FromResult(0);
now it is working.
@JeevaJose Please close the issue