コード例 #1
0
ファイル: AssemblyMainAbst.cs プロジェクト: VinceIborra/ser
        /// <summary>
        /// Todo
        /// </summary>
        private void BootstrapAssembly()
        {
            // Get a way to create the top level objects
            Log4netFactory      log4netFactory      = new Log4netFactoryImpl();
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();

            // Initialise the individual bootstrappers
            CommonLoggingBootstrapper commonLoggingBootstrapper = bootstrapperFactory.NewCommonLoggingBootstrapper();
            LogBootstrapper           logBootstrapper           = bootstrapperFactory.NewLogBootstrapper(Log4NetAssembly, Log4NetAssemblyName, Log4NetXmlCfgFPathFile);
            LoggerSetter loggerSetter = log4netFactory.NewBootstrapDependentLoggerSetter(logBootstrapper);
            //AssemblyResolver assemblyResolver = bootstrapperFactory.NewAssemblyResolver(loggerSetter);
            SpringBootstrapper springBootstrapper = bootstrapperFactory.NewSpringBootstrapper(loggerSetter, SpringContextPathFile);

            // Combine them into a composite
            IList <Bootstrapper> bootstrappers = new List <Bootstrapper>();

            bootstrappers.Add(commonLoggingBootstrapper);
            bootstrappers.Add(logBootstrapper);
            bootstrappers.Add(loggerSetter);
            //bootstrappers.Add(assemblyResolver);
            bootstrappers.Add(springBootstrapper);
            Bootstrapper bootstrapper = bootstrapperFactory.NewCompositeBootstrapper(loggerSetter, bootstrappers);

            // Bootstrap
            bootstrapper.Bootstrap();

            // Set the main object
            AddinMain = (AddinMain)springBootstrapper.Ctx.GetObject("AddinMainObj");
        }
コード例 #2
0
        protected override void Configure()
        {
            // Basic
            var builder = new ContainerBuilder();

            builder.RegisterType <EventAggregator>().As <IEventAggregator>().SingleInstance();
            builder.RegisterType <WindowManager>().As <IWindowManager>().SingleInstance();

            // ViewModels
            builder.RegisterType <ShellViewModel>().As <IShell>().SingleInstance();
            builder.RegisterType <MainPageViewModel>().As <IMainPageViewModel>().SingleInstance();
            builder.RegisterType <Screen1ViewModel>().As <IScreen1ViewModel>().SingleInstance();
            builder.RegisterType <Screen2ViewModel>().As <IScreen2ViewModel>().SingleInstance();

            // Services
            LogBootstrapper.RegisterTypes(builder);
            builder.RegisterType <LogService>().As <ILogService>().SingleInstance();
            builder.RegisterType <FooService.FooService>().As <IFooService>().SingleInstance();


            // Others
            builder.RegisterType <DateTimeWrapper>().As <IDateTimeWrapper>().SingleInstance();

            _container = builder.Build();
        }
コード例 #3
0
        public override void Initialize(NfsTestCase testCase)
        {
            StdTestCase stdTestCase = (StdTestCase)testCase;

            LogBootstrapper.Bootstrap();
            stdTestCase.LoggerSetter = LoggerSetter;
        }
コード例 #4
0
        public void TestBootstrap()
        {
            LogBootstrapper bootstrapper = BootstrapperFactory.NewLogBootstrapper();

            Assert.IsFalse(bootstrapper.IsDone);
            bootstrapper.Bootstrap();
            Assert.IsTrue(bootstrapper.IsDone);
        }
コード例 #5
0
        public void TestNewLogBootstrapper()
        {
            LogBootstrapper logBootstrapper = BootstrapperFactory.NewLogBootstrapper();

            Assert.IsNotNull(logBootstrapper);
            Assert.IsInstanceOf(typeof(Bootstrapper), logBootstrapper);
            Assert.IsInstanceOf(typeof(LogBootstrapperImpl), logBootstrapper);
        }
コード例 #6
0
ファイル: Log4netFactoryImpl.cs プロジェクト: VinceIborra/ser
        public LoggerSetter NewBootstrapDependentLoggerSetter(LogBootstrapper logBootstrapper)
        {
            IList <LoggerRecipient>            loggerRecipients = new List <LoggerRecipient>();
            BootstrapDependentLoggerSetterImpl loggerSetter     = new BootstrapDependentLoggerSetterImpl();

            loggerSetter.LogBootstrapper  = logBootstrapper;
            loggerSetter.LoggerRecipients = loggerRecipients;
            return(loggerSetter);
        }
コード例 #7
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);
        }
コード例 #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 TestInitialize()
        {
            // Factories
            Log4netFactory      = new Log4netFactoryImpl();
            BootstrapperFactory = new BootstrapperFactoryImpl();
            MvcFactoryImpl      = new FactoryImpl();
            MvcFactory          = MvcFactoryImpl;
            MockMvcFactory      = new Vji.Mock.Mvc.FactoryImpl();

            // Bootstrapping - Logging
            LogBootstrapper logBootstrapper = BootstrapperFactory.NewLogBootstrapper();

            LoggerSetter                = Log4netFactory.NewLoggerSetter();
            LoggerSetterImpl            = (LoggerSetterImpl)LoggerSetter;
            MvcFactoryImpl.LoggerSetter = LoggerSetter;
            MockMvcFactory.LoggerSetter = LoggerSetter;

            // Bootstrapping others
            IList <Bootstrapper> bootstrappers = new List <Bootstrapper>();

            bootstrappers.Add(logBootstrapper);
            bootstrappers.Add(LoggerSetter);
            Bootstrapper = BootstrapperFactory.NewCompositeBootstrapper(LoggerSetter, bootstrappers);
        }
コード例 #10
0
        static void Main(string[] args)
        {
            // Get a way to create the top level objects
            Log4netFactory      log4netFactory      = new Log4netFactoryImpl();
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();
            MainFactory         mainFactory         = new MainFactoryClass();

            mainFactory.BootstrapperFactory = bootstrapperFactory;

            // Initialise the individual bootstrappers
            LogBootstrapper    logBootstrapper    = bootstrapperFactory.NewLogBootstrapper();
            LoggerSetter       loggerSetter       = log4netFactory.NewBootstrapDependentLoggerSetter(logBootstrapper);
            AssemblyResolver   assemblyResolver   = bootstrapperFactory.NewAssemblyResolver(loggerSetter);
            SpringBootstrapper springBootstrapper = bootstrapperFactory.NewSpringBootstrapper(loggerSetter);

            // Create the program components
            Bootstrapper bootstrapper = mainFactory.NewProgramBootstrapper(logBootstrapper, loggerSetter, assemblyResolver, springBootstrapper);
            Runner       runner       = bootstrapperFactory.NewSpringRunner(loggerSetter, springBootstrapper);

            // Create and run the program
            Program program = mainFactory.NewProgram(bootstrapper, runner);

            program.Run();
        }
コード例 #11
0
        public static int Main(string[] args)
        {
            try
            {
                Console.WriteLine("Bootstrapping...");
                ConfigurationBootstrapper.Bootstrap(args, out var configuration, out var appSettingsRoot);
                LogBootstrapper.Bootstrap(appSettingsRoot.Application, appSettingsRoot.Logging);
                WebHostBootstrapper.Bootstrap <Startup>(configuration, out var webHost);

                Log.Debug("Starting web host");
                webHost.Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "A fatal exception occurred.");
                return(1);
            }
            finally
            {
                Log.CloseAndFlush();
            }

            return(0);
        }
コード例 #12
0
 public void TestInitialize()
 {
     Log4netFactory      = new Log4netFactoryImpl();
     BootstrapperFactory = new BootstrapperFactoryImpl();
     LogBootstrapper     = BootstrapperFactory.NewLogBootstrapper();
 }