Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
            }
        }