簡體   English   中英

Azure 功能管理器功能切換以在運行時使用 Label 進行評估

[英]Azure Feature Manager Feature Toggle To Evaluate Using Label During Runtime

Using feature toggles in Azure Feature Manager gives the option to configure a label when creating a feature, in .NET to use that label the only option I could find is to set the label during startup when configuring Azure App Configuration which can be done like:

 config.AddAzureAppConfiguration(
                        options =>
                        {
                            options.Connect(settings.GetConnectionString("Config"))
                                .UseFeatureFlags(o =>
                                {
                                    o.Label = "Test";
                                    o.CacheExpirationInterval = TimeSpan.FromSeconds(1);
                                });
                        },

這種方法的問題是在運行期間我們無法更改 label,因為它是在啟動期間預先配置的。 問題是我們如何管理不同的標簽,假設我有 100 個標簽,我希望我的應用程序評估關於其 label 的功能切換,我無法找到實現這一點的方法。 為了評估功能切換,我們像這樣調用功能管理器await _featureManager.IsEnabledAsync(setting);

我會說你不能,這不是一件壞事。 標簽在那里,因此您可以將一個功能標志保存兩次,可能使用不同的值和過濾器。 例如:

  • MyFlag(標簽:測試)真
  • MyFlag(標簽:生產)假

或者

  • MyFlag(標簽:美國)是的
  • MyFlag(標簽:亞洲)假

因此,您應該使用標簽為不同階段或不同地區或您可能擁有的任何其他用例的一個功能保存不同的值。 您不應該在正在運行的應用程序中的標簽之間切換。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM