Configures Microsoft.FeatureManagement
built into .NET Core to work with popular feature flag services like Launch Darkly, GrowthBook, and Flagsmith.
Due to how differences in behavior and data available, some functionality may be simplified to accommodate the simplest use cases (i.e. feature flag is on or off) without regard to things like experiments, attributes, or metrics for example. Pull requests are welcome for adding functionality or implementing a new provider.
Package Name | NuGet |
---|---|
Growthbook.FeatureManagement |
|
Flagsmith.FeatureManagement |
Not implemented |
LaunchDarkly.FeatureManagement |
Not implemented |
In your Program.cs
file, add the registration below to add the relevant feature flag provider. Although not necessary, if you explicitly call services.AddFeatureManagement()
, it must come after the call to add one of the feature flag providers below.
services.AddGrowthbookFeatureManagement();
Get your GrowthBook Client Key to configure your AppSettings.json
to have the relevant settings needed to configure the feature flag provider as shown below:
{
"Growthbook": {
"ApiHost": "https://cdn.growthbook.io",
"ClientKey": "sdk-CLIENTKEYHERE"
}
}
The GrowthBook C# SDK is used internally. The available options for the configuration are the same as the properties availble on the Context
class.
Then you inject IFeatureManager
to be used for flag lookups.
See Tutorial: Use feature flags in an ASP.NET Core app for more information on how to use .NET Core's built-in feature management system.