[英]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.我正在尝试在我的 .net 核心 api 项目中设置 Azure 功能管理器。 I have two flags setup in azure. One with 'Development' label and one without a label.我在 azure 中设置了两个标志。一个带有“开发”label,另一个没有 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.我试图只检索开发 label 的功能标志。但它返回了 azure 中的所有两个标志。我试图找出我做错了什么。 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.尝试使用 label 属性。 ( https://learn.microsoft.com/en-us/do.net/api/microsoft.extensions.configuration.azureappconfiguration.featuremanagement.featureflagoptions.label?view=azure-do.net ) ( 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";
}));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.