private IEnumerable <IFeatureToggle> BuildDependencies(Dictionary <string, KeyValuePair <ToggleConfig, IFeatureToggle> > toggles)
        {
            foreach (var t in toggles)
            {
                ToggleConfig   config = t.Value.Key;
                IFeatureToggle toggle = t.Value.Value;

                var dependencyToggle = toggle as DependencyToggle;

                if (dependencyToggle != null)
                {
                    var dependencyNames = config.Dependencies.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    BuildDependencies(dependencyToggle, toggles, dependencyNames);
                }

                yield return(toggle);
            }
        }
        private IFeatureToggle ConvertToFeatureToggle(ToggleConfig config)
        {
            IFeatureToggle toggle;

            if (config.IsEstablished)
            {
                toggle = new EstablishedFeatureToggle(config.Name);
            }
            else if ((config.FromDate != null) || (config.ToDate != null))
            {
                toggle = new DateRangeToggle(config.Name, config.Enabled, config.FromDate, config.ToDate);
            }
            else
            {
                toggle = new BooleanToggle(config.Name, config.Enabled);
            }

            return(string.IsNullOrEmpty(config.Dependencies)
                ? toggle
                : new DependencyToggle(toggle));
        }
 /// <summary>
 /// Removes the specified service config.
 /// </summary>
 /// <param name="serviceConfig">The service config.</param>
 public void Remove(ToggleConfig serviceConfig)
 {
     BaseRemove(serviceConfig.Name);
 }
 /// <summary>
 /// Adds the specified service config.
 /// </summary>
 /// <param name="serviceConfig">The service config.</param>
 public void Add(ToggleConfig serviceConfig)
 {
     BaseAdd(serviceConfig);
 }