Skip to content

Instantly share code, notes, and snippets.

@r4hulp r4hulp/MyBotModules.cs
Last active Dec 29, 2017

Embed
What would you like to do?
Bot Registrations
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
You can’t perform that action at this time.