【发布时间】:2018-08-26 02:05:04
【问题描述】:
我一直在为 C# 中的多租户 azure bot 实现以下功能,这对于验证应用凭据非常有用。
C# : Creating a Single Bot Service to Support Multiple Bot Applications
但是,我想知道机器人数据存储是否也可以这样做? 我目前有标准的 Azure 表存储机器人数据存储,它使用 web.config 中定义的单个连接字符串:
Conversation.UpdateContainer(
builder =>
{
builder.RegisterModule(new ReflectionSurrogateModule());
builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));
//var store = new InMemoryDataStore();
var store = new TableBotDataStore(ConfigurationManager.AppSettings["BotStorage"]);
builder.Register(c => store)
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
.AsSelf()
.SingleInstance();
});
在我的 ICredentialProvider 实现中(如文章示例中所述)。如果我将客户连接字符串与他们的 App ID 和密码一起存储,是否可以根据客户/机器人序列化数据存储在上面的依赖注入中提取该引用,然后将该数据保存/读取到客户 Azure 表存储?
【问题讨论】:
-
If I store the customers connection string along side their App ID and Password, is it possible to pull that reference in the dependency injection above based on the customer/bot serialising the data store and then save/read that data to the customers Azure table storage?您能否详细说明您的要求?是否要将带有 Microsoft appId 和密码的存储连接字符串存储到字典中,并在注册 TableBotDataStore 时访问存储连接字符串? -
@FeiHan 差不多。它们不必全部存储在一起,但我认为将 azure 连接字符串与应用程序 ID 一起存储是最合乎逻辑的地方。我的想法是,我可以根据 Http 上下文身份声明拉取连接字符串(类似于通过多重身份验证实现的)
标签: c# botframework multi-tenant azure-table-storage