Exemplo n.º 1
0
        /// <summary>
        /// Can be overrided in a derived class to control how this is implemented. By default, will retrieve a feature and run a foreach with all the activation strategies
        /// </summary>
        /// <param name="featureId">Required id of the feature</param>
        /// <param name="context">Optional context</param>
        /// <param name="token">Cancellation token</param>
        /// <returns>Boolean indicating if the feature is considered enabled</returns>
        protected virtual async Task <bool> IsFeatureEnabledAsyncCore(string featureId, IFeatureContext context, CancellationToken token)
        {
            if (string.IsNullOrWhiteSpace(featureId))
            {
                throw new ArgumentNullException(featureId);
            }

            var feature = await _featureStore.GetFeatureByIdAsync(featureId, token).ConfigureAwait(false);

            return(await IsFeatureEnabledAsyncCore(feature, context, token).ConfigureAwait(false));
        }