示例#1
0
        public static void Main()
        {
            Console.WriteLine("================== Running simple ==================");
            Console.WriteLine();

            //// Actually it is not necessary to have the strategy and disposable extensions in a using scope.
            //// The bootstrapper takes care of that. I use it here to calm FxCop ;)

            using (var simpleBootstrapper = new DefaultBootstrapper <ISimpleExtension>())
                using (var simpleStrategy = new SimpleStrategy())
                    using (var thirdSimpleExtension = new ThirdSimpleExtension())
                    {
                        simpleBootstrapper.Initialize(simpleStrategy);

                        simpleBootstrapper.AddExtension(new FirstSimpleExtension());
                        simpleBootstrapper.AddExtension(new SecondSimpleExtension());
                        simpleBootstrapper.AddExtension(thirdSimpleExtension);

                        simpleBootstrapper.Run();
                        simpleBootstrapper.Shutdown();
                    }

            Console.WriteLine("================== End simple ==================");
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();

            Console.WriteLine("================== Running complex ==================");
            Console.WriteLine();

            //// Actually it is not necessary to have the strategy and disposable extensions in a using scope.
            //// The bootstrapper takes care of that. I use it here to calm FxCop ;)

            using (var complexBootstrapper = new DefaultBootstrapper <IComplexExtension>())
                using (var complexStrategy = new ComplexStrategy())
                {
                    complexBootstrapper.Initialize(complexStrategy);

                    complexBootstrapper.AddExtension(new Log4NetExtension());
                    complexBootstrapper.AddExtension(new ExtensionWhichRegistersSomething());
                    complexBootstrapper.AddExtension(new ExtensionWhichNeedsDependency());
                    complexBootstrapper.AddExtension(new ExtensionWhichIsFunqlet());
                    complexBootstrapper.AddExtension(new ExtensionWithExtensionConfigurationSection());
                    complexBootstrapper.AddExtension(
                        new ExtensionWithExtensionConfigurationSectionWithConversionAndCustomizedLoading());
                    complexBootstrapper.AddExtension(new ExtensionWithExtensionConfigurationSectionWithDictionary());

                    complexBootstrapper.Run();
                    complexBootstrapper.Shutdown();
                }

            Console.WriteLine("================== End complex ==================");
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
        }
示例#2
0
        public static void Main()
        {
            Console.WriteLine("================== Running simple ==================");
            Console.WriteLine();

            //// Actually it is not necessary to have the strategy and disposable extensions in a using scope. 
            //// The bootstrapper takes care of that. I use it here to calm FxCop ;)

            using (var simpleBootstrapper = new DefaultBootstrapper<ISimpleExtension>())
            using (var simpleStrategy = new SimpleStrategy())
            using (var thirdSimpleExtension = new ThirdSimpleExtension())
            {
                simpleBootstrapper.Initialize(simpleStrategy);

                simpleBootstrapper.AddExtension(new FirstSimpleExtension());
                simpleBootstrapper.AddExtension(new SecondSimpleExtension());
                simpleBootstrapper.AddExtension(thirdSimpleExtension);

                simpleBootstrapper.Run();
                simpleBootstrapper.Shutdown();
            }

            Console.WriteLine("================== End simple ==================");
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();

            Console.WriteLine("================== Running complex ==================");
            Console.WriteLine();

            //// Actually it is not necessary to have the strategy and disposable extensions in a using scope. 
            //// The bootstrapper takes care of that. I use it here to calm FxCop ;)

            using (var complexBootstrapper = new DefaultBootstrapper<IComplexExtension>())
            using (var complexStrategy = new ComplexStrategy())
            {
                complexBootstrapper.Initialize(complexStrategy);

                complexBootstrapper.AddExtension(new Log4NetExtension());
                complexBootstrapper.AddExtension(new ExtensionWhichRegistersSomething());
                complexBootstrapper.AddExtension(new ExtensionWhichNeedsDependency());
                complexBootstrapper.AddExtension(new ExtensionWhichIsFunqlet());
                complexBootstrapper.AddExtension(new ExtensionWithExtensionConfigurationSection());
                complexBootstrapper.AddExtension(
                    new ExtensionWithExtensionConfigurationSectionWithConversionAndCustomizedLoading());
                complexBootstrapper.AddExtension(new ExtensionWithExtensionConfigurationSectionWithDictionary());

                complexBootstrapper.Run();
                complexBootstrapper.Shutdown();
            }

            Console.WriteLine("================== End complex ==================");
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
        }
示例#3
0
        public static void Main(string[] args)
        {
            using (var bootstrapper = new DefaultBootstrapper<ISensor>())
            {
                bootstrapper.Initialize(new SensorLifetimeStrategy());

                PrintHeader();

                bootstrapper.Run();

                PrintBody();

                bootstrapper.Shutdown();

                PrintFooter();
            }
        }
示例#4
0
        public static void Main(string[] args)
        {
            using (var bootstrapper = new DefaultBootstrapper <ISensor>())
            {
                bootstrapper.Initialize(new SensorLifetimeStrategy());

                PrintHeader();

                bootstrapper.Run();

                PrintBody();

                bootstrapper.Shutdown();

                PrintFooter();
            }
        }
示例#5
0
        protected override void ConfigureServices(IServiceCollection services)
        {
            var cultureInfo = new CultureInfo("en-US");

            _defaultBootstrapper = new DefaultBootstrapper(
                tenantCode: TENANT_CODE,
                localization: LOCALIZATIONS,
                uiLanguage: UI_LANGUAGE,
                uiCultureInfo: cultureInfo,
                cultureInfo: cultureInfo,
                serviceCollection: services
            );
            _defaultBootstrapper.Initialize(false);

            _customBootstrapper = new CustomBootstrapper(
                tenantCode: TENANT_CODE,
                localization: LOCALIZATIONS,
                uiLanguage: UI_LANGUAGE,
                uiCultureInfo: cultureInfo,
                cultureInfo: cultureInfo,
                serviceCollection: services
            );
            _customBootstrapper.Initialize(true);
        }