コード例 #1
0
        public virtual IApplication Build()
        {
            IContainer container = null;
            var        host      = new Application(BeforeRunners, Runners);

            ContainerBuilder.Register(x => host).As <IApplication>().SingleInstance();
            ContainerBuilder.Register(x => container).As <IContainer>().SingleInstance();
            ContainerBuilder.RegisterType <ConsoleLogger>().As <ILogger>().SingleInstance();

            ModuleRegisters.ForEach(x => { x(ContainerBuilder); });
            container = ContainerBuilder.Build();
            Initializers.ForEach(x => { x(container); });
            host.Container = container;

            return(host);
        }
コード例 #2
0
        public virtual IApplication Build()
        {
            LoadModule();

            IContainer container = null;
            var        host      = new Application(BeforeRunners, Runners, Disposer);

            ContainerBuilder.Register(x => host).As <IApplication>().SingleInstance();
            ContainerBuilder.Register(x => container).As <IContainer>().SingleInstance();
            ContainerBuilder.RegisterType <ConsoleLoggerFactory>().As <ILoggerFactory>().SingleInstance();

            ModuleRegisters.ForEach(x => x(ContainerBuilder));
            BeforeBuilders.ForEach(x => x(ContainerBuilder));

            container = ContainerBuilder.Build();


            Initializers.ForEach(x => x(container));
            host.Container       = container;
            host.JimuAppSettings = JimuAppSettings;

            return(host);
        }