AlphaFeatureToggler 1.0.2
dotnet add package AlphaFeatureToggler --version 1.0.2
NuGet\Install-Package AlphaFeatureToggler -Version 1.0.2
<PackageReference Include="AlphaFeatureToggler" Version="1.0.2" />
<PackageVersion Include="AlphaFeatureToggler" Version="1.0.2" />
<PackageReference Include="AlphaFeatureToggler" />
paket add AlphaFeatureToggler --version 1.0.2
#r "nuget: AlphaFeatureToggler, 1.0.2"
#:package AlphaFeatureToggler@1.0.2
#addin nuget:?package=AlphaFeatureToggler&version=1.0.2
#tool nuget:?package=AlphaFeatureToggler&version=1.0.2
AlphaFeatureToggler Setup & API Guide
Quick Start
Install the NuGet package
- Add
AlphaFeatureTogglerto your project via NuGet.
- Add
Add to Dependency Injection
- In your
Program.csor startup:services.AddAlphaFeatureToggler(opt => { opt.Environment = FeatureEnvironment.Development; // or Staging/Production opt.EnableCaching = true; // optional, default is false opt.FeatureCacheSeconds = 10; // optional, cache duration in seconds }); - This registers all required services, in-memory/demo implementations, and the DI extension method. No manual registrations needed.
- In your
Get the Feature Toggle Service
- Inject or resolve
IFeatureToggleService:var toggler = provider.GetRequiredService<IFeatureToggleService>();
- Inject or resolve
Set and Check Feature Flags
- Use the in-memory feature manager for demo/testing:
var featureManager = provider.GetRequiredService<Microsoft.FeatureManagement.IFeatureManager>(); featureManager.SetFeature("MyFeature", true); bool enabled = await toggler.IsEnabledAsync("MyFeature");
- Use the in-memory feature manager for demo/testing:
Kill Switch, Audit, and Propagation
- Use
ActivateKillSwitchAsync,DeactivateKillSwitchAsync, andClearFeatureCachefor enterprise scenarios.
- Use
Features & Integrations
- Feature Toggling: Per environment, user, or role.
- Kill Switch: Instantly disable features for safety.
- Audit Logging: Batched, offloaded, and extensible.
- Change Propagation: Real-time cache invalidation.
- Promotion Workflow: Safe flag promotion between environments.
- API Integration: Extensible points for external systems.
- Access Control: Role/user-based access.
- Caching: Optional, thread-safe, and configurable.
- In-Memory Implementations: For demo/testing, easily swappable for production.
Extending for Production
- Replace in-memory implementations with your own (e.g., Redis, SQL, distributed cache, external audit loggers).
- Implement interfaces:
IFeatureAuditLogger,IFeatureChangePropagator,IFeaturePromotionWorkflow,IFeatureApiIntegration. - Register your implementations before calling
AddAlphaFeatureToggler.
Example: Console App Integration
See src/AlphaFeatureToggler.ConsoleDemo/Program.cs for a complete, realistic usage example demonstrating all enterprise scenarios:
var services = new ServiceCollection();
services.AddAlphaFeatureToggler(opt => {
opt.Environment = FeatureEnvironment.Production;
opt.EnableCaching = true;
opt.FeatureCacheSeconds = 30;
});
var provider = services.BuildServiceProvider();
var toggler = provider.GetRequiredService<IFeatureToggleService>();
var featureManager = provider.GetRequiredService<Microsoft.FeatureManagement.IFeatureManager>();
featureManager.SetFeature("AdvancedReporting", true);
bool canAccess = await toggler.IsEnabledAsync("AdvancedReporting");
**See the full demo in
src/AlphaFeatureToggler.ConsoleDemo/Program.csfor advanced scenarios: user/role access, enable/disable, kill switch, caching, change propagation, and audit logging.
Performance & Best Practices
- Enable caching for high-throughput scenarios.
- Use
ClearFeatureCacheafter flag changes for instant propagation. - Use the audit log for compliance and debugging.
- For distributed scenarios, implement a distributed cache and change propagator.
CI/CD & NuGet
- The package is built, tested, and published via GitHub Actions.
- See the status badge in
README.md. - Release notes and changelog are maintained in
CHANGELOG.md.
For more, see the source code and integration tests for advanced usage and extension points.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- Microsoft.FeatureManagement (>= 3.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2 | 147 | 5/31/2025 |