AlphaFeatureToggler 1.0.2

dotnet add package AlphaFeatureToggler --version 1.0.2
                    
NuGet\Install-Package AlphaFeatureToggler -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AlphaFeatureToggler" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AlphaFeatureToggler" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="AlphaFeatureToggler" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AlphaFeatureToggler --version 1.0.2
                    
#r "nuget: AlphaFeatureToggler, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AlphaFeatureToggler@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AlphaFeatureToggler&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=AlphaFeatureToggler&version=1.0.2
                    
Install as a Cake Tool

AlphaFeatureToggler Setup & API Guide

Quick Start

  1. Install the NuGet package

    • Add AlphaFeatureToggler to your project via NuGet.
  2. Add to Dependency Injection

    • In your Program.cs or 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.
  3. Get the Feature Toggle Service

    • Inject or resolve IFeatureToggleService:
      var toggler = provider.GetRequiredService<IFeatureToggleService>();
      
  4. 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");
      
  5. Kill Switch, Audit, and Propagation

    • Use ActivateKillSwitchAsync, DeactivateKillSwitchAsync, and ClearFeatureCache for enterprise scenarios.

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.cs for 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 ClearFeatureCache after 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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