简体   繁体   中英

Azure Feature Manager UseFeatureFlags filter by label not working as expected .net Core

I am trying to setup Azure Feature Manager in my .net core api project. I have two flags setup in azure. One with 'Development' label and one without a label. 在此处输入图像描述

I am trying to retrieve only the feature flags with development label. But it returns me all two flags in azure. I am trying to figure out where I done something wrong. If anybody has any idea on how to fix this would be really helpful.

 var settings = config.Build();
 var connection = settings.GetConnectionString("AppConfig");
                  config.AddAzureAppConfiguration(options =>
                    options
                    .Connect(connection)
                    .UseFeatureFlags(opt => {
                        opt.Select(KeyFilter.Any, "Development");
                    }));

Code to retrieve all feature flags available.

    var featureNames = _featureManager.GetFeatureNamesAsync();

    await foreach (var name in featureNames)
    {
        var isEnabled = await _featureManager.IsEnabledAsync(name);
        featureList.Add(new FeatureFlag()
        {
            Feature = name,
            IsEnabled = isEnabled
        });
    }

Which returns,

在此处输入图像描述

Try it with the label property. ( https://learn.microsoft.com/en-us/do.net/api/microsoft.extensions.configuration.azureappconfiguration.featuremanagement.featureflagoptions.label?view=azure-do.net )

Like so:

var settings = config.Build();
var connection = settings.GetConnectionString("AppConfig");
              config.AddAzureAppConfiguration(options =>
                options
                .Connect(connection)
                .UseFeatureFlags(opt => {
                    opt.Label =  "Development";
                }));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM