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

ContosoFlowersModule.cs 3.0 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  1. namespace ContosoFlowers
  2. {
  3. using System.Configuration;
  4. using Autofac;
  5. using BotAssets;
  6. using BotAssets.Dialogs;
  7. using Dialogs;
  8. using Microsoft.Bot.Builder.Dialogs;
  9. using Microsoft.Bot.Builder.Internals.Fibers;
  10. using Microsoft.Bot.Builder.Location;
  11. using Microsoft.Bot.Builder.Scorables;
  12. using Microsoft.Bot.Connector;
  13. using Services.Models;
  14. public class ContosoFlowersModule : Module
  15. {
  16. protected override void Load(ContainerBuilder builder)
  17. {
  18. base.Load(builder);
  19. builder.RegisterType<ContosoFlowersDialogFactory>()
  20. .Keyed<IContosoFlowersDialogFactory>(FiberModule.Key_DoNotSerialize)
  21. .AsImplementedInterfaces()
  22. .InstancePerLifetimeScope();
  23. builder.RegisterType<RootDialog>()
  24. .As<IDialog<object>>()
  25. .InstancePerDependency();
  26. builder.RegisterType<SettingsScorable>()
  27. .As<IScorable<IActivity, double>>()
  28. .InstancePerLifetimeScope();
  29. builder.RegisterType<FlowerCategoriesDialog>()
  30. .InstancePerDependency();
  31. builder.RegisterType<BouquetsDialog>()
  32. .InstancePerDependency();
  33. builder.RegisterType<SavedAddressDialog>()
  34. .InstancePerDependency();
  35. builder.RegisterType<SettingsDialog>()
  36. .InstancePerDependency();
  37. // Location Dialog
  38. // ctor signature: LocationDialog(string apiKey, string channelId, string prompt, LocationOptions options = LocationOptions.None, LocationRequiredFields requiredFields = LocationRequiredFields.None, LocationResourceManager resourceManager = null);
  39. builder.RegisterType<LocationDialog>()
  40. .WithParameter("apiKey", ConfigurationManager.AppSettings["MicrosoftBingMapsKey"])
  41. .WithParameter("options", LocationOptions.UseNativeControl | LocationOptions.ReverseGeocode)
  42. .WithParameter("requiredFields", LocationRequiredFields.StreetAddress | LocationRequiredFields.Locality | LocationRequiredFields.Country)
  43. .WithParameter("resourceManager", new ContosoLocationResourceManager())
  44. .InstancePerDependency();
  45. // Service dependencies
  46. builder.RegisterType<Services.InMemoryOrdersService>()
  47. .Keyed<Services.IOrdersService>(FiberModule.Key_DoNotSerialize)
  48. .AsImplementedInterfaces()
  49. .SingleInstance();
  50. builder.RegisterType<Services.InMemoryBouquetRepository>()
  51. .Keyed<Services.IRepository<Bouquet>>(FiberModule.Key_DoNotSerialize)
  52. .AsImplementedInterfaces()
  53. .SingleInstance();
  54. builder.RegisterType<Services.InMemoryFlowerCategoriesRepository>()
  55. .Keyed<Services.IRepository<FlowerCategory>>(FiberModule.Key_DoNotSerialize)
  56. .AsImplementedInterfaces()
  57. .SingleInstance();
  58. }
  59. }
  60. }
Tip!

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

Comments

Loading...