Example #1
0
        public override bool IsEnabled(string toggleName, UnleashContext context, bool defaultSetting)
        {
            if (_enableAll)
            {
                return(true);
            }
            if (_disableAll)
            {
                return(false);
            }

            return(_features.ContainsKey(toggleName) ? _features[toggleName] : defaultSetting);
        }
Example #2
0
        // public override bool IsEnabled(string toggleName, bool defaultSetting)
        // {
        //     return IsEnabled(toggleName, _contextProvider.Context, defaultSetting);
        // }

        public override bool IsEnabled(string toggleName, UnleashContext context, bool defaultSetting)
        {
            bool          enabled;
            FeatureToggle featureToggle = _toggleRepository.GetToggle(toggleName);

            if (featureToggle == null)
            {
                enabled = defaultSetting;
            }
            else if (!featureToggle.IsEnabled)
            {
                enabled = false;
            }
            else
            {
                enabled = featureToggle
                          .Strategies
                          .Any(s => GetStrategy(s.Name).IsEnabled(s.Parameters, context));
            }

            Count(toggleName, enabled);
            return(enabled);
        }
Example #3
0
 public override bool IsEnabled(string toggleName, UnleashContext context)
 {
     return(IsEnabled(toggleName, context, false));
 }