public async Task ClearContextAsync(IConversationContext context) { try { var azureContext = new AzureConversationContext { PartitionKey = context.ConnectorType.ToString(), RowKey = context.Entry.Message.Sender.Id, ETag = "*", StateAction = context.StateAction }; var deleteOperation = TableOperation.Delete(azureContext); await this.PrepareTable(this.config.BotConversationContextTableName).ExecuteAsync(deleteOperation); } catch (StorageException e) { if (e.RequestInformation.HttpStatusCode == (int)HttpStatusCode.NotFound) { return; } throw; } }
public async Task SaveContextAsync(IConversationContext context) { var contextData = this.serializer.Serialize(context); var azureContext = new AzureConversationContext { PartitionKey = context.ConnectorType.ToString(), RowKey = context.Entry.Message.Sender.Id, StateAction = context.StateAction, ContextData = contextData }; var insertOperation = TableOperation.InsertOrReplace(azureContext); await this.PrepareTable(this.config.BotConversationContextTableName).ExecuteAsync(insertOperation); }