using Autofac; using Autofac.Extras.AggregateService; using JiraTimeBot.Core.Configuration; using JiraTimeBot.Ui.Models; using JiraTimeBot.Ui.ViewModels; namespace JiraTimeBot.Ui { public class Bootstrapper { public IContainer Build() { var builder = new ContainerBuilder(); builder.Register(c => { var result = new MainWindow(); result.DataContext = c.Resolve(); return result; }).InstancePerLifetimeScope(); builder.RegisterType().As(); builder.RegisterType().InstancePerLifetimeScope(); builder.RegisterType().InstancePerLifetimeScope(); builder.RegisterType().InstancePerLifetimeScope(); builder.RegisterType().InstancePerLifetimeScope(); builder.RegisterType().InstancePerLifetimeScope(); builder.RegisterType() .InstancePerLifetimeScope(); builder.RegisterType().InstancePerLifetimeScope(); builder.RegisterType() .AsSelf() .As() .InstancePerLifetimeScope(); builder.RegisterAggregateService(); builder.RegisterType() .As() .InstancePerLifetimeScope(); var container = builder.Build(); return container; } } }