Synetec.FeatureManagement
1.0.2
dotnet add package Synetec.FeatureManagement --version 1.0.2
NuGet\Install-Package Synetec.FeatureManagement -Version 1.0.2
<PackageReference Include="Synetec.FeatureManagement" Version="1.0.2" />
<PackageVersion Include="Synetec.FeatureManagement" Version="1.0.2" />
<PackageReference Include="Synetec.FeatureManagement" />
paket add Synetec.FeatureManagement --version 1.0.2
#r "nuget: Synetec.FeatureManagement, 1.0.2"
#:package Synetec.FeatureManagement@1.0.2
#addin nuget:?package=Synetec.FeatureManagement&version=1.0.2
#tool nuget:?package=Synetec.FeatureManagement&version=1.0.2
Synetec.FeatureManagement
This is a wrapper for the Microsoft.FeatureManagement library that adds additional functionality and provides an endpoint for a frontend application to retrieve feature flags.
It will also provide a way to manage feature flags in a database instead of in configuration files.
Installation
You can install the Synetec.FeatureManagement package via NuGet Package Manager Console:
Install-Package Synetec.FeatureManagement
Usage
To use the Synetec.FeatureManagement package, follow these steps:
- Register the feature management services in your
Startup.csorProgram.csfile:
// See full list of configuration options in Synetec.FeatureManagementOptions class
services.AddSynetecFeatureManagement(o => {
o.AdminRole = "Admin";
});
- Use the feature management services in your application:
public class MyService
{
private readonly IFeatureManager _featureManager;
public MyService(IFeatureManager featureManager)
{
_featureManager = featureManager;
}
public async Task DoSomethingAsync()
{
if (await _featureManager.IsEnabledAsync("MyFeature"))
{
// Feature is enabled, do something
}
else
{
// Feature is disabled, do something else
}
}
}
- Access the feature flags endpoint:
You can access the feature flags endpoint at /config to retrieve the current feature flags and their statuses. This endpoint is secured with the 'ReaderRole' defined in the configuration options.
It will return a JSON object with the feature flags and their statuses for the requesting user, so it will take account of specific flags for the user or their roles.
{
"MyFeature": true,
"AnotherFeature": false
}
Creating feature filters
The recommended approach is to add the feature to appsettings.json in the off state. For local development, you can then enable the feature in appsettings.Development.json or via the database.
On Azure, you can use App Configuration to manage your feature flags.
Two additional metadata properties are supported for each feature flag:
- Clients: a string array of client app names to allow filtering of the features reported to that site.
- AddedOn: used to keep track of how long a feature has been active in the code base - to help with managing removal of features.
Example appsettings.json entry:
{
"FeatureManagement": {
"MyFeature": {
"EnabledFor": [ ],
"Clients": [ "WebApp", "MobileApp" ],
"AddedOn": "2025-11-15"
}
}
}
EnabledFor can be left empty if you just want to enable/disable the feature globally.
Features can be enabled as 'always on', for a specific user or group (which is the role the user has in the system) , or as a percentage rollout. Note: groups must have a Name and a RolloutPercentage.
{
"FeatureManagement": {
"NewHomePage": {
"EnabledFor": [
{
"Name": "Microsoft.Targeting",
"Parameters": {
"Audience": {
"Users": [],
"Groups": [
{
"Name": "User",
"RolloutPercentage": 100
}
]
}
}
}
], //
"Clients": [ "UserManagerApp" ],
"AddedOn": "2025-11-19"
},
"BetaUserProfile": {
"EnabledFor": [
{ "Name": "AlwaysOn" }
],
"Clients": [ "UserManagerApp" ],
"AddedOn": "2025-11-19"
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Authorization (>= 8.0.22)
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Azure.AppConfiguration.AspNetCore (>= 8.4.0)
- Microsoft.EntityFrameworkCore (>= 9.0.10)
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.10)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- Microsoft.FeatureManagement (>= 4.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Adds key vault support to AppConfiguration