Пример #1
0
        public virtual async Task <FeatureListDto> GetAsync([NotNull] string providerName, [NotNull] string providerKey)
        {
            await CheckProviderPolicy(providerName);

            var featureDefinitions = FeatureDefinitionManager.GetAll();
            var features           = new List <FeatureDto>();

            foreach (var featureDefinition in featureDefinitions)
            {
                features.Add(new FeatureDto
                {
                    Name        = featureDefinition.Name,
                    DisplayName = featureDefinition.DisplayName?.Localize(StringLocalizerFactory),
                    ValueType   = featureDefinition.ValueType,
                    Description = featureDefinition.Description?.Localize(StringLocalizerFactory),
                    ParentName  = featureDefinition.Parent?.Name,
                    Value       = await FeatureManager.GetOrNullAsync(featureDefinition.Name, providerName, providerKey)
                });
            }

            SetFeatureDepth(features, providerName, providerKey);

            return(new FeatureListDto {
                Features = features
            });
        }