private static FeatureToggleFactory LoadFactory()
        {
            var config = (ToggleConfigurationSection)ConfigurationManager.GetSection("nToggle");
            var toggleRepositoryDictionary    = new Dictionary <String, IFeatureToggleRepository>();
            var toggleGlobalSettingDictionary = new Dictionary <String, bool>();
            var toggleValueDictionary         = new Dictionary <String, bool>();
            var staticToggleRepository        = new StaticToggleRepository(toggleValueDictionary);

            foreach (ToggleElement toggle in config.Toggles)
            {
                toggleGlobalSettingDictionary.Add(toggle.Name, toggle.Value);
                if (!toggle.Value || String.IsNullOrEmpty(toggle.Repository))
                {
                    toggleRepositoryDictionary.Add(toggle.Name, staticToggleRepository);
                    toggleValueDictionary.Add(toggle.Name, toggle.Value);
                }
                else
                {
                    string[] strings     = toggle.Repository.Split(',');
                    var      dynamicRepo =
                        (IFeatureToggleRepository)Activator.CreateInstance(strings[0], strings[1]).Unwrap();
                    toggleRepositoryDictionary.Add(toggle.Name, dynamicRepo);
                }
            }

            return(new FeatureToggleFactory(toggleRepositoryDictionary, toggleGlobalSettingDictionary));
        }
        private static FeatureToggleFactory LoadFactory()
        {
            var config = (ToggleConfigurationSection) ConfigurationManager.GetSection(
                "nToggle");
            var toggleRepositoryDictionary = new Dictionary<String, IFeatureToggleRepository>();
            var toggleValueDictionary = new Dictionary<String, bool>();
            var staticToggleRepository = new StaticToggleRepository(toggleValueDictionary);
            foreach (ToggleElement toggle in config.Toggles)
            {
                if (!toggle.Value || String.IsNullOrEmpty(toggle.Repository))
                {
                    toggleRepositoryDictionary.Add(toggle.Name, staticToggleRepository);
                    toggleValueDictionary.Add(toggle.Name, toggle.Value);
                }
                else
                {
                    var strings = toggle.Repository.Split(',');

                    var dynamicRepo =
                        (IFeatureToggleRepository) Activator.CreateInstance(strings[0], strings[1]).Unwrap();
                    toggleRepositoryDictionary.Add(toggle.Name,dynamicRepo);
                }
            }

            return new FeatureToggleFactory(toggleRepositoryDictionary);
        }