Simple feature toggling library to work with basic on/off toggles, allowing the toggles to be stored in the service of your choice.
- In Memory
- AWS
- Parameter Store
- DynamoDB Table
- Secrets Manager
- Azure
- App Configuration
- Install from Nuget
dotnet add package SimpleToggle.Core
- Update StartUp.cs
public class StartUp
{
...
public void ConfigureServices(IServiceCollection services)
{
...
services.AddFeatureService<InMemoryToggleSource>();
...
}
...
}
- Use
IFeatureService
public class Features
{
public const string MYSTERY_FEATURE = "feature_indentifier";
}
public class Sample
{
private readonly IFeatureService _featureService;
public Sample(IFeatureService featureService)
{
_featureService = featureService;
}
public async Task<string> MysteryFeature ()
{
if (await _featureService.GetToggleValue(Features.MYSTERY_FEATURE))
{
return "Feature Enabled";
}
else
{
return "Feature Not Enabled";
}
}
}
- Add Additional AWS Sources
- Add GPC and Azure Equivalents
- Allow for some basic configuration options
- Publish to Nuget
- Added tests
For more feature rich alternatives, that allow A/B testing toggles, more then just on/off toggle and user targeting and tracking.