public void RegisterModules()
        {
            var builder = new ContainerBuilder();
            builder.RegisterModules(Assembly.GetExecutingAssembly());
            var container = builder.Build();

            Assert.IsNotNull(container.Resolve<IContainerModule>());
        }
		private void RegisterContainer()
		{
			var builder = new ContainerBuilder();
			builder.RegisterControllers(Assembly.GetExecutingAssembly());
			builder.RegisterModules(Assembly.GetExecutingAssembly());
			_container = builder.Build();
			DependencyResolver.SetResolver(new AutofacDependencyResolver(_container));
		}
        private void InitializeApplication(ContainerBuilder builder, Module[] modules)
        {
            builder.RegisterInstance(new DefaultMessageBus()).As<IBus>().SingleInstance();
            builder.RegisterModules(modules);
            builder.RegisterModule(new ViewModelModule());

            ContainerHolder.Initialize(builder.Build());
            MainPage = new NavigationPage(new LoginPage())
            {
				BarBackgroundColor = Color.FromHex("#3C8513"),
				BarTextColor = Color.FromHex("#FCD23C")
            };

            Navigation = MainPage.Navigation;
        }
示例#4
0
        public static IContainer Init()
        {
            var builder = new ContainerBuilder();

            var assembly = Assembly.GetExecutingAssembly();

            builder.RegisterApiControllers(assembly);
            builder.RegisterBootstrappers(assembly);
            builder.RegisterModules();

            builder
                .RegisterType<Foo>()
                .AsSelf();

            var container = builder.Build();

            container.ConfigureDependencyResolver();
            container.InitBootstrappers();

            return container;
        }