public void TestAutoConfiguration()
        {
            var componentScanner = ComponentUtil.BuildComponentScanner();
            var components = componentScanner.ScanByAttribute("Archimedes.*").ToList();

            var conf = new ComponentRegisterer(new ElderModuleConfiguration());
            conf.RegisterComponents(components);
        }
        public static IModuleConfiguration BuildAutoConfiguration(params string[] regexFilters)
        {
            var configuration = new ElderModuleConfiguration();
            var registerer = new ComponentRegisterer(configuration);

            var componentScanner = ComponentUtil.BuildComponentScanner();
            var components = componentScanner.ScanByAttribute(regexFilters).ToList();

            registerer.RegisterComponents(components);

            return configuration;
        }
        public static IModuleConfiguration BuildAutoConfiguration(params string[] regexFilters)
        {
            var configuration = new ElderModuleConfiguration();
            var registerer    = new ComponentRegisterer(configuration);

            var componentScanner = ComponentUtil.BuildComponentScanner();
            var components       = componentScanner.ScanByAttribute(regexFilters).ToList();

            registerer.RegisterComponents(components);

            return(configuration);
        }
        /// <summary>
        ///  Enables Auto-Configuration, which basically scans for Components, handles the configuration
        /// and makes the app ready for usage.
        /// 
        ///  Components must be marked with [Service] or [Controller].
        /// </summary>
        protected void EnableAutoConfiguration()
        {
            if (!_isAutoConfigured)
            {
                try
                {
                    var configuration = Environment.Configuration;

                    configuration.GetOptional("application.log.level").IfPresent(logLevel =>
                    {
                        var hierarchy = (Hierarchy) LogManager.GetRepository();
                        hierarchy.Root.Level = hierarchy.LevelMap[logLevel];
                    });

                    var configurationLoader = new ConfigurationLoader(this);
                    configurationLoader.Load();

                    var assemblyFiltersStr = configuration.GetOptional(ArchimedesPropertyKeys.ComponentScanAssemblies);
                    var assemblyFilters = assemblyFiltersStr.Map(x => x.Split(',')).OrElse(new string[0]);

                    var configurer = new ComponentRegisterer(_container.Configuration);
                    var allFoundComponents = ScanComponents(assemblyFilters);
                    configurer.RegisterComponents(allFoundComponents);

                    _container.RegisterInstance<IEnvironmentService>(_environmentService);
                    _container.RegisterInstance<ApplicationContext>(this);

                    _isAutoConfigured = true;

                    OnContextInitialized(allFoundComponents);
                }
                catch (Exception e)
                {
                    throw new ApplicationContextInitialisationException("Failed to initialize and configure application context!", e);
                }
            }
        }