Skip to content

Instantly share code, notes, and snippets.

@r4hulp
Last active December 29, 2017 10:49
Show Gist options
  • Save r4hulp/90be92a9ff08fab943004618dea0f93f to your computer and use it in GitHub Desktop.
Save r4hulp/90be92a9ff08fab943004618dea0f93f to your computer and use it in GitHub Desktop.
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