in blog-samples/CSharp/AzureSql-StateClient/Microsoft.Bot.Sample.AzureSql/SqlStateService/SqlBotDataEntity.cs [99:126]
internal static SqlBotDataEntity GetSqlBotDataEntity(IAddress key, BotStoreType botStoreType, SqlBotDataContext context)
{
SqlBotDataEntity entity = null;
var query = context.BotData.OrderByDescending(d => d.Timestamp);
switch (botStoreType)
{
case BotStoreType.BotConversationData:
entity = query.FirstOrDefault(d => d.BotStoreType == botStoreType
&& d.ChannelId == key.ChannelId
&& d.ConversationId == key.ConversationId);
break;
case BotStoreType.BotUserData:
entity = query.FirstOrDefault(d => d.BotStoreType == botStoreType
&& d.ChannelId == key.ChannelId
&& d.UserId == key.UserId);
break;
case BotStoreType.BotPrivateConversationData:
entity = query.FirstOrDefault(d => d.BotStoreType == botStoreType
&& d.ChannelId == key.ChannelId
&& d.ConversationId == key.ConversationId
&& d.UserId == key.UserId);
break;
default:
throw new ArgumentException("Unsupported bot store type!");
}
return entity;
}