コード例 #1
0
        private static void ExecuteBootstrappers(BootstrapperConfig config)
        {
            var compositeBootstrapper = new CompositeBootstrapper(
                new PlatformBootstrapper(),
                new ApplicationBootstrapper(),
                new PresentationBootstrapper());

            compositeBootstrapper.Execute(config);
        }
コード例 #2
0
        public override void OnCreate()
        {
            var config = new BootstrapperConfig();

            config.SetSimpleIoc(new SimpleIoc());

            var compositeBootstrapper = new CompositeBootstrapper(new AndroidBootstrapper(), new CoreBootstrapper());

            compositeBootstrapper.Execute(config);
        }
コード例 #3
0
        private void InitFramework()
        {
            var config = new BootstrapperConfig();

            config.SetSimpleIoc(new SimpleIoc());

            var compositeBootstrapper = new CompositeBootstrapper(new IosBootstrapper(), new CoreBootstrapper());

            compositeBootstrapper.Execute(config);
        }
コード例 #4
0
        public void TestNewCompositeBootstrapper()
        {
            CompositeBootstrapper compositeBootstrapper = BootstrapperFactory.NewCompositeBootstrapper(LoggerSetter, Bootstrappers);

            Assert.IsNotNull(compositeBootstrapper);
            Assert.IsInstanceOf(typeof(Bootstrapper), compositeBootstrapper);
            Assert.IsInstanceOf(typeof(CompositeBootstrapperImpl), compositeBootstrapper);
            CompositeBootstrapperImpl compositeBootstrapperImpl = (CompositeBootstrapperImpl)compositeBootstrapper;

            Assert.AreEqual(Bootstrappers, compositeBootstrapperImpl.SubBootstrappers);
            Assert.IsTrue(LoggerSetterImpl.LoggerRecipients.Contains(compositeBootstrapper));
        }
コード例 #5
0
        public Bootstrapper NewProgramBootstrapper(LogBootstrapper logBootstrapper, LoggerSetter loggerSetter, AssemblyResolver assemblyResolver, SpringBootstrapper springBootstrapper)
        {
            IList <Bootstrapper> bootstrappers = new List <Bootstrapper>();

            bootstrappers.Add(logBootstrapper);
            bootstrappers.Add(loggerSetter);
            bootstrappers.Add(assemblyResolver);
            bootstrappers.Add(springBootstrapper);
            CompositeBootstrapper compositeBootstrapper = BootstrapperFactory.NewCompositeBootstrapper(loggerSetter, bootstrappers);

            return(compositeBootstrapper);
        }
コード例 #6
0
ファイル: Tests.cs プロジェクト: raulnq/Jal.Bootstrapper
        public void Configure_WithCompositeBootstrapper_ShouldBeTrue()
        {
            var bootstrapper = new DoSomethingBootstrapper();

            var composite = new CompositeBootstrapper(new IBootstrapper[] { bootstrapper });

            composite.Configure();

            composite.Result.ShouldBe(true);

            bootstrapper.Result.ShouldBe(true);
        }
コード例 #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            CrossCurrentActivity.Current.Init(this, savedInstanceState);

            var config = new BootstrapperConfig();

            config.SetSimpleIoc(new SimpleIoc());

            var compositeBootstrapper = new CompositeBootstrapper(
                new CoreBootstrapper(),
                new AndroidBootstrapper());

            compositeBootstrapper.Execute(config);

            base.OnCreate(savedInstanceState);
        }
コード例 #8
0
        public void TestInitialize()
        {
            Log4netFactory log4netFactory = new Log4netFactoryImpl();

            BootstrapperFactory = new BootstrapperFactoryImpl();
            LogBootstrapper logBootstrapper = BootstrapperFactory.NewLogBootstrapper();

            LoggerSetter       = log4netFactory.NewLoggerSetter();
            SpringBootstrapper = BootstrapperFactory.NewSpringBootstrapper(LoggerSetter);
            IList <Bootstrapper> bootstrappers = new List <Bootstrapper>();

            bootstrappers.Add(logBootstrapper);
            bootstrappers.Add(LoggerSetter);
            bootstrappers.Add(SpringBootstrapper);
            Bootstrapper = BootstrapperFactory.NewCompositeBootstrapper(LoggerSetter, bootstrappers);
        }
コード例 #9
0
        public void TestBootstrap()
        {
            CompositeBootstrapper bootstrapper = BootstrapperFactory.NewCompositeBootstrapper(LoggerSetter, MockBootstrapperList);

            foreach (Bootstrapper subBootstrapper in MockBootstrapperList)
            {
                Assert.IsFalse(subBootstrapper.IsDone);
            }
            Assert.IsFalse(bootstrapper.IsDone);
            bootstrapper.Bootstrap();
            foreach (Bootstrapper subBootstrapper in MockBootstrapperList)
            {
                Assert.IsTrue(subBootstrapper.IsDone);
            }
            Assert.IsTrue(bootstrapper.IsDone);
        }
コード例 #10
0
ファイル: AppDelegate.cs プロジェクト: Siaukovich/XmpViaFlexi
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            var config = new BootstrapperConfig();

            config.SetSimpleIoc(new SimpleIoc());
            var compositeBootstrapper = new CompositeBootstrapper(
                new CoreBootstrapper(),
                new IosBootstrapper());

            compositeBootstrapper.Execute(config);

            Window = new UIWindow(UIScreen.MainScreen.Bounds)
            {
                RootViewController = new RootNavigationController()
            };
            Window.MakeKeyAndVisible();

            return(true);
        }
コード例 #11
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                                  builder => builder.AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader()
                                  .AllowCredentials());
            });

            var directory = AppDomain.CurrentDomain.BaseDirectory;

            var finder = AssemblyFinder.Create(directory);

            var assemblies = finder.GetAssemblies();

            var compositionassembly = assemblies.Where(x => x.FullName.Contains("Beauty.Barry.Api")).ToArray();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Beauty.Barry.Api", Version = "v1"
                });
            });

            var applicationname = Configuration["ApplicationName"];

            var logging = Configuration.GetSection("LogConfiguration").Get <LogConfiguration>();

            LogManager.Configure(logging);

            var iocbootstrapper = new LightInjectBootStrapper(compositionassembly, serviceContainer =>
            {
                serviceContainer.RegisterSettings(Configuration);

                serviceContainer.RegisterFrom <ServiceLocatorCompositionRoot>();

                serviceContainer.RegisterAspects(new Assembly[] { });

                serviceContainer.RegisterFrom <AspectLoggerCompositionRoot>();

                serviceContainer.RegisterFrom <AspectSerializerCompositionRoot>();

                serviceContainer.RegisterFrom <AspectJsonSerializerCompositionRoot>();

                serviceContainer.RegisterFrom <AutomaticInterceptionCompositionRoot>();

                serviceContainer.RegisterSettings(Configuration);

                serviceContainer.RegisterFrom <AspectJsonSerializerCompositionRoot>();

                serviceContainer.RegisterCorrelation();
            }, new ContainerOptions {
                EnablePropertyInjection = false
            });

            var compositeBootstrapper = new CompositeBootstrapper(new IBootstrapper[] { iocbootstrapper });

            compositeBootstrapper.Configure();

            var container = iocbootstrapper.Result;

            var logger = LogManager.GetLogger(applicationname);

            container.Register(x => logger, new PerContainerLifetime());

            Mapper.Initialize(cfg => { cfg.AddProfiles(compositionassembly); });

            Mapper.Configuration.CompileMappings();

            //return container.CreateServiceProvider(services);

            var obj = container.CreateServiceProvider(services);

            var xyz = obj.GetService <IDepartmentApplication>();

            return(obj);
        }