Last active
December 29, 2017 10:49
-
-
Save r4hulp/90be92a9ff08fab943004618dea0f93f to your computer and use it in GitHub Desktop.
Bot Registrations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyBotModules : Module | |
{ | |
protected override void Load(ContainerBuilder builder) | |
{ | |
base.Load(builder); | |
//Register RootDialog as IDialog<object> | |
builder.RegisterType<RootDialog>() | |
.As<IDialog<object>>() | |
.InstancePerDependency(); | |
//We will come to this later | |
builder.RegisterType<DialogFactory>() | |
.Keyed<IDialogFactory>(FiberModule.Key_DoNotSerialize) | |
.AsImplementedInterfaces() | |
.InstancePerLifetimeScope(); | |
//Register Dialogs | |
builder.RegisterType<UserProfileDialog>().InstancePerDependency(); | |
builder.RegisterType<UserSettingsDialog>().InstancePerDependency(); | |
//Register bot specific services, make sure you Key them as DoNotSerialize | |
builder.RegisterType<DailyStatusService>() | |
.Keyed<IDailyStatusService>(FiberModule.Key_DoNotSerialize) | |
.AsImplementedInterfaces() | |
.InstancePerDependency(); | |
//Register | |
builder.RegisterType<HttpClient>() | |
.Keyed<HttpClient>(FiberModule.Key_DoNotSerialize) | |
.AsSelf() | |
.InstancePerDependency(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment