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.2 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
  1. namespace CreateNewConversationBot
  2. {
  3. using System.Reflection;
  4. using System.Web.Http;
  5. using Autofac;
  6. using Autofac.Integration.WebApi;
  7. using Microsoft.Bot.Builder.Dialogs.Internals;
  8. using Microsoft.Bot.Connector;
  9. public class WebApiApplication : System.Web.HttpApplication
  10. {
  11. public static ILifetimeScope FindContainer()
  12. {
  13. var config = GlobalConfiguration.Configuration;
  14. var resolver = (AutofacWebApiDependencyResolver)config.DependencyResolver;
  15. return resolver.Container;
  16. }
  17. protected void Application_Start()
  18. {
  19. GlobalConfiguration.Configure(WebApiConfig.Register);
  20. var builder = new ContainerBuilder();
  21. builder.RegisterModule(new DialogModule());
  22. builder.RegisterModule(new SurveyModule());
  23. // Register your Web API controllers.
  24. builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
  25. var config = GlobalConfiguration.Configuration;
  26. var container = builder.Build();
  27. config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
  28. }
  29. }
  30. }
Tip!

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

Comments

Loading...