Esempio n. 1
0
        public bool TryGetState <TFeature>(out Caching.ICachedCodeFeatureState featureState)
        {
            if (_cache != null)
            {
                return(_cache.TryGetState <TFeature>(out featureState));
            }

            featureState = default(Caching.ICachedCodeFeatureState);
            return(false);
        }
Esempio n. 2
0
        bool Evaluate()
        {
            ICachedCodeFeatureState    codeFeatureState;
            ICachedContextFeatureState contextFeatureState;

            if (_contextCache.TryGetContextFeatureState(_context, out contextFeatureState))
            {
                if (contextFeatureState.TryGetCodeFeatureState(CodeFeatureMetadata <TFeature> .Id, out codeFeatureState))
                {
                    _evaluated.Evaluated(ContextMetadata <TContext> .Id, contextFeatureState.Key, codeFeatureState.Enabled);
                    return(codeFeatureState.Enabled);
                }
            }

            bool enabled = _cache.TryGetState <TFeature>(out codeFeatureState) && codeFeatureState.Enabled;

            _evaluated.Evaluated(enabled);

            return(enabled);
        }
Esempio n. 3
0
        bool GetEnabled()
        {
            ICachedCodeFeatureState featureState;

            return(_cache.TryGetState <TFeature>(out featureState) && featureState.Enabled);
        }