Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Global.asax.cs 1.3 KB

You have to be logged in to leave a comment. Sign In
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
36
37
38
39
40
41
42
43
  1. namespace TestBot
  2. {
  3. using System.Web.Http;
  4. using System.Web.Routing;
  5. using Autofac;
  6. using Helpers;
  7. using Microsoft.Bot.Builder.Dialogs;
  8. using Microsoft.Bot.Builder.Dialogs.Internals;
  9. using Microsoft.Bot.Builder.History;
  10. public class WebApiApplication : System.Web.HttpApplication
  11. {
  12. protected void Application_Start()
  13. {
  14. this.RegisterBotDependencies();
  15. RouteConfig.RegisterRoutes(RouteTable.Routes);
  16. GlobalConfiguration.Configure(WebApiConfig.Register);
  17. }
  18. private void RegisterBotDependencies()
  19. {
  20. var builder = new ContainerBuilder();
  21. builder
  22. .Register(c => new ActivityLogger(c.Resolve<IBotData>()))
  23. .As<IActivityLogger>()
  24. .InstancePerLifetimeScope();
  25. foreach (var commandType in CommandsHelper.GetRegistrableTypes())
  26. {
  27. builder
  28. .RegisterType(commandType)
  29. .Keyed(commandType.Name, commandType)
  30. .AsImplementedInterfaces()
  31. .InstancePerMatchingLifetimeScope(DialogModule.LifetimeScopeTag);
  32. }
  33. builder.Update(Conversation.Container);
  34. }
  35. }
  36. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...