Skip to content

Commit 78f8073

Browse files
committed
Prepare feature management docs for 2.0-preview release.
1 parent 84be8c0 commit 78f8073

File tree

3 files changed

+26
-28
lines changed

3 files changed

+26
-28
lines changed

articles/azure-app-configuration/quickstart-feature-flag-aspnet-core.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Add the [Secret Manager tool](https://docs.microsoft.com/aspnet/core/security/ap
8282
1. Add reference to the `Microsoft.Azure.AppConfiguration.AspNetCore` and the `Microsoft.FeatureManagement.AspNetCore` NuGet packages by running the following commands:
8383

8484
```
85-
dotnet add package Microsoft.Azure.AppConfiguration.AspNetCore --version 2.0.0-preview-009470001-12
86-
dotnet add package Microsoft.FeatureManagement.AspNetCore --version 1.0.0-preview-009000001-1251
85+
dotnet add package Microsoft.Azure.AppConfiguration.AspNetCore --version {tbd}
86+
dotnet add package Microsoft.FeatureManagement.AspNetCore --version {tbd}
8787
```
8888

8989
1. Run the following command to restore packages for your project:

articles/azure-app-configuration/quickstart-feature-flag-dotnet.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,33 @@ The .NET Feature Management libraries extend the framework with comprehensive fe
6464
1. Update the `Main` method to connect to App Configuration, specifying the `UseFeatureFlags` option so that feature flags are retrieved. Then display a message if the `Beta` feature flag is enabled.
6565
6666
```csharp
67-
static void Main(string[] args)
67+
public static void Main(string[] args)
68+
{
69+
AsyncMain().Wait();
70+
}
71+
72+
private static async Task AsyncMain()
6873
{
6974
IConfigurationRoot configuration = new ConfigurationBuilder()
70-
.AddAzureAppConfiguration(options =>
71-
{
75+
.AddAzureAppConfiguration(options =>
76+
{
7277
options.Connect(Environment.GetEnvironmentVariable("ConnectionString"))
73-
.UseFeatureFlags();
78+
.UseFeatureFlags();
7479
}).Build();
75-
76-
IServiceCollection services = new ServiceCollection();
77-
services.AddSingleton<IConfiguration>(configuration).AddFeatureManagement();
78-
IFeatureManager featureManager = services.BuildServiceProvider().GetRequiredService<IFeatureManager>();
79-
80-
if (featureManager.IsEnabled("Beta"))
81-
{
82-
Console.WriteLine("Welcome to the beta");
83-
}
8480
85-
Console.WriteLine("Hello World!");
81+
IServiceCollection services = new ServiceCollection();
82+
83+
services.AddSingleton<IConfiguration>(configuration).AddFeatureManagement();
84+
85+
using (ServiceProvider serviceProvider = services.BuildServiceProvider())
86+
{
87+
IFeatureManager featureManager = serviceProvider.GetRequiredService<IFeatureManager>();
88+
89+
if (await featureManager.IsEnabledAsync("Beta"))
90+
{
91+
Console.WriteLine("Welcome to the beta!");
92+
}
93+
}
8694
}
8795
```
8896

articles/azure-app-configuration/use-feature-flags-dotnet-core.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ The basic pattern of feature management is to first check if a feature flag is s
175175
```csharp
176176
IFeatureManager featureManager;
177177
...
178-
if (featureManager.IsEnabled(nameof(MyFeatureFlags.FeatureA)))
178+
if (await featureManager.IsEnabled(nameof(MyFeatureFlags.FeatureA)))
179179
{
180180
// Run the following code
181181
}
@@ -252,7 +252,7 @@ The feature `<feature>` tag can also be used to show content if any or all featu
252252

253253
## MVC filters
254254

255-
You can set up MVC filters so that they're activated based on the state of a feature flag. The following code adds an MVC filter named `SomeMvcFilter`. This filter is triggered within the MVC pipeline only if `FeatureA` is enabled.
255+
You can set up MVC filters so that they're activated based on the state of a feature flag. The following code adds an MVC filter named `SomeMvcFilter`. This filter is triggered within the MVC pipeline only if `FeatureA` is enabled. This capability is limited to `IAsyncActionFilter`.
256256

257257
```csharp
258258
using Microsoft.FeatureManagement.FeatureFilters;
@@ -267,16 +267,6 @@ public void ConfigureServices(IServiceCollection services)
267267
}
268268
```
269269

270-
## Routes
271-
272-
You can use feature flags to dynamically expose routes. The following code adds a route, which sets `Beta` as the default controller only when `FeatureA` is enabled:
273-
274-
```csharp
275-
app.UseMvc(routes => {
276-
routes.MapRouteForFeature(nameof(MyFeatureFlags.FeatureA), "betaDefault", "{controller=Beta}/{action=Index}/{id?}");
277-
});
278-
```
279-
280270
## Middleware
281271

282272
You can also use feature flags to conditionally add application branches and middleware. The following code inserts a middleware component in the request pipeline only when `FeatureA` is enabled:

0 commit comments

Comments
 (0)