示例#1
0
        public 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,
                    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
            });
        }
 public static Task <string> GetOrNullDefaultAsync(this IFeatureManager featureManager, [NotNull] string name, bool fallback = true)
 {
     return(featureManager.GetOrNullAsync(name, DefaultValueFeatureValueProvider.ProviderName, null, fallback));
 }
 public static Task <string> GetOrNullForEditionAsync(this IFeatureManager featureManager, [NotNull] string name, Guid editionId, bool fallback = true)
 {
     return(featureManager.GetOrNullAsync(name, EditionFeatureValueProvider.ProviderName, editionId.ToString(), fallback));
 }
示例#4
0
 public static Task <string> GetOrNullForClientAsync(this IFeatureManager featureManager, [NotNull] string name, string clientId, bool fallback = true)
 {
     return(featureManager.GetOrNullAsync(name, ClientFeatureValueProvider.ProviderName, clientId, fallback));
 }
示例#5
0
 public static Task <string> GetOrNullForTenantAsync(this IFeatureManager featureManager, [NotNull] string name, Guid tenantId, bool fallback = true)
 {
     return(featureManager.GetOrNullAsync(name, TenantFeatureValueProvider.ProviderName, tenantId.ToString(), fallback));
 }
示例#6
0
 public static Task <string> GetOrNullForUserAsync(this IFeatureManager featureManager, string name, Guid userId, bool fallback = true)
 {
     return(featureManager.GetOrNullAsync(name, UserFeatureValueProvider.ProviderName, userId.ToString(), fallback));
 }
 public static Task <string> GetOrNullForCurrentTenantAsync(this IFeatureManager featureManager, [NotNull] string name, bool fallback = true)
 {
     return(featureManager.GetOrNullAsync(name, TenantFeatureValueProvider.ProviderName, null, fallback));
 }