Beispiel #1
0
        private Bootstrap()
        {
            var sw = new Stopwatch();

            sw.Start();
            _log.Debug("New Bootstrap");

            try
            {
                _log.Debug("EnvironmentChecker");
                EnvironmentChecker.RunCheckers();


                var configurations = ConfigurationManager.GetModulesConfiguration();

                foreach (var configuration in configurations)
                {
                    var mainAssembly           = AssemblyManager.GetMainAssembly(configuration.AssemblyName);
                    var implementationAssembly = AssemblyManager.GetImplementationAssembly(configuration.AssemblyName);

                    // LogManager.Configure(configuration.AssemblyName, configuration.LogLevel);
                    UnityContainerInitializer.Configure();
                    UnityContainerInitializer.AutoRegister(mainAssembly, implementationAssembly);
                }


                var sessionFactories = ConfigurationManager.GetSessionConfiguration();

                foreach (var sessionFactory in sessionFactories)
                {
                    //  Log.To(typeof(Bootstrap)).Message("Prepare to configure [{0}] session", sessionFactory.Name).Debug();

                    PersistenceManager.Configure(sessionFactory.Name, sessionFactory.ConnectionString, sessionFactory.Factory, sessionFactory.IsDebug);
                }

                //  Log.To(typeof(Bootstrap)).Message("Finalizing Bootstrap at {0}ms", sw.ElapsedMilliseconds).Debug();
                // LogManager.FinalizeFrameworkLogger();
            }
            catch (Exception exception)
            {
                _log.Fatal("Failed to run bootstrap", exception);
                throw;
            }
        }
Beispiel #2
0
 public void Register <T, U>() where U : T
 {
     UnityContainerInitializer.Register <T, U>();
 }