예제 #1
0
        public static void RegisterComponents()
        {
            lock (Lock)
            {
                // Only initialize once
                if (GlobalConfiguration.Configuration.DependencyResolver != null &&
                    GlobalConfiguration.Configuration.DependencyResolver.GetType() == typeof(UnityDependencyResolver))
                {
                    return;
                }

                var section   = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
                var container = new UnityContainer();

                section.Configure(container);

                QuartzConfig.Register(container);

                GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
            }
        }
예제 #2
0
        public static void RegisterComponents()
        {
            lock (Lock)
            {
                // Only initialize once
                if (GlobalConfiguration.Configuration.DependencyResolver != null &&
                    GlobalConfiguration.Configuration.DependencyResolver.GetType() == typeof(UnityDependencyResolver))
                {
                    return;
                }

                var container     = new UnityContainer();
                var unitySections = new[] { "crossroadsCommonUnity", "unity", "asyncJobsUnity" };

                foreach (var section in unitySections.Select(sectionName => (UnityConfigurationSection)ConfigurationManager.GetSection(sectionName)))
                {
                    container.LoadConfiguration(section);
                }

                QuartzConfig.Register(container);

                GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
            }
        }