forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Global.asax.cs
35 lines (29 loc) · 1.17 KB
/
Global.asax.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace CustomStateBot
{
using System;
using System.Configuration;
using System.Reflection;
using System.Web.Http;
using Autofac;
using Microsoft.Bot.Builder.Azure;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Dialogs.Internals;
using Microsoft.Bot.Connector;
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
Uri docDbServiceEndpoint = new Uri(ConfigurationManager.AppSettings["DocumentDbServiceEndpoint"]);
string docDbEmulatorKey = ConfigurationManager.AppSettings["DocumentDbAuthKey"];
var builder = new ContainerBuilder();
builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));
var store = new DocumentDbBotDataStore(docDbServiceEndpoint, docDbEmulatorKey);
builder.Register(c => store)
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
.AsSelf()
.SingleInstance();
builder.Update(Conversation.Container);
GlobalConfiguration.Configure(WebApiConfig.Register);
}
}
}