Skip to content

Commit 5c3e941

Browse files
authored
Adds a simplified index (#228)
1 parent ad83a72 commit 5c3e941

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

README.md

+23-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# ASP.NET Core Feature Flags
1+
# .NET Feature Management
22

3-
Feature flags provide a way for ASP.NET Core applications to turn features on or off dynamically. Developers can use feature flags in simple use cases like conditional statements to more advanced scenarios like conditionally adding routes or MVC filters. Feature flags build on top of the .NET Core configuration system. Any .NET Core configuration provider is capable of acting as the back-bone for feature flags.
3+
Feature flags provide a way for .NET and ASP.NET Core applications to turn features on or off dynamically. Developers can use feature flags in simple use cases like conditional statements to more advanced scenarios like conditionally adding routes or MVC filters. Feature flags build on top of the .NET Core configuration system. Any .NET Core configuration provider is capable of acting as the back-bone for feature flags.
44

55
Here are some of the benefits of using this library:
66

@@ -20,15 +20,26 @@ Here are some of the benefits of using this library:
2020

2121
**API Reference**: https://go.microsoft.com/fwlink/?linkid=2091700
2222

23-
### Feature Flags
23+
## Index
24+
* [Feature Flags](#feature-flags)
25+
* [Feature Filters](#feature-filters)
26+
* [Feature Flag Declaration](#feature-flag-declaration)
27+
* [ASP.NET Core Integration](#ASPNET-Core-Integration)
28+
* [Built-in Feature Filters](#built-in-Feature-Filters)
29+
* [Targeting](#targeting)
30+
* [Targeting Exclusion](#targeting-exclusion)
31+
* [Caching](#caching)
32+
* [Custom Feature Providers](#custom-feature-providers)
33+
34+
## Feature Flags
2435
Feature flags are composed of two parts, a name and a list of feature-filters that are used to turn the feature on.
2536

2637
### Feature Filters
2738
Feature filters define a scenario for when a feature should be enabled. When a feature is evaluated for whether it is on or off, its list of feature-filters are traversed until one of the filters decides the feature should be enabled. At this point the feature is considered enabled and traversal through the feature filters stops. If no feature filter indicates that the feature should be enabled, then it will be considered disabled.
2839

2940
As an example, a Microsoft Edge browser feature filter could be designed. This feature filter would activate any features it is attached to as long as an HTTP request is coming from Microsoft Edge.
3041

31-
## Registration
42+
### Feature Flag Configuration
3243

3344
The .NET Core configuration system is used to determine the state of feature flags. The foundation of this system is `IConfiguration`. Any provider for IConfiguration can be used as the feature state provider for the feature flag library. This enables scenarios ranging from appsettings.json to Azure App Configuration and more.
3445

@@ -194,6 +205,9 @@ public class HomeController : Controller
194205
}
195206
```
196207

208+
## ASP.NET Core Integration
209+
The feature management library provides functionality in ASP.NET Core and MVC to enable common feature flag scenarios in web applications. These capabilities are available by referencing the [Microsoft.FeatureManagement.AspNetCore](https://www.nuget.org/packages/Microsoft.FeatureManagement.AspNetCore/) NuGet package.
210+
197211
### Controllers and Actions
198212
MVC controller and actions can require that a given feature, or one of any list of features, be enabled in order to execute. This can be done by using a `FeatureGateAttribute`, which can be found in the `Microsoft.FeatureManagement.Mvc` namespace.
199213

@@ -531,7 +545,7 @@ The following steps demonstrate an example of a progressive rollout for a new 'B
531545

532546
This strategy for rolling out a feature is built in to the library through the included [Microsoft.Targeting](./README.md#MicrosoftTargeting) feature filter.
533547

534-
## Targeting in a Web Application
548+
### Targeting in a Web Application
535549

536550
An example web application that uses the targeting feature filter is available in the [FeatureFlagDemo](./examples/FeatureFlagDemo) example project.
537551

@@ -547,13 +561,13 @@ services.AddFeatureManagement();
547561
548562
```
549563

550-
### ITargetingContextAccessor
564+
#### ITargetingContextAccessor
551565

552566
To use the `TargetingFilter` in a web application an implementation of `ITargetingContextAccessor` is required. This is because when a targeting evaluation is being performed information such as what user is currently being evaluated is needed. This information is known as the targeting context. Different web applications may extract this information from different places. Some common examples of where an application may pull the targeting context are the request's HTTP context or a database.
553567

554568
An example that extracts targeting context information from the application's HTTP context is included in the [FeatureFlagDemo](./examples/FeatureFlagDemo/HttpContextTargetingContextAccessor.cs) example project. This method relies on the use of `IHttpContextAccessor` which is discussed [here](./README.md#Using-HttpContext).
555569

556-
## Targeting in a Console Application
570+
### Targeting in a Console Application
557571

558572
The targeting filter relies on a targeting context to evaluate whether a feature should be turned on. This targeting context contains information such as what user is currently being evaluated, and what groups the user in. In console applications there is typically no ambient context available to flow this information in to the targeting filter, thus it must be passed directly when `FeatureManager.IsEnabledAsync` is called. This is supported through the use of the `ContextualTargetingFilter`. Applications that need to float the targeting context into the feature manager should use this instead of the `TargetingFilter.`
559573

@@ -581,7 +595,7 @@ The `ContextualTargetingFilter` still uses the feature filter alias [Microsoft.T
581595

582596
An example that uses the `ContextualTargetingFilter` in a console application is available in the [TargetingConsoleApp](./examples/TargetingConsoleApp) example project.
583597

584-
## Targeting Evaluation Options
598+
### Targeting Evaluation Options
585599

586600
Options are available to customize how targeting evaluation is performed across all features. These options can be configured when setting up feature management.
587601

@@ -592,7 +606,7 @@ services.Configure<TargetingEvaluationOptions>(options =>
592606
});
593607
```
594608

595-
## Targeting Exclusion
609+
### Targeting Exclusion
596610

597611
When defining an Audience, users and groups can be excluded from the audience. This is useful when a feature is being rolled out to a group of users, but a few users or groups need to be excluded from the rollout. Exclusion is defined by adding a list of users and groups to the `Exclusion` property of the audience.
598612
```

0 commit comments

Comments
 (0)