Innovabit.DotNet.Interceptors.FeatureGates.Abstractions 2.0.117

dotnet add package Innovabit.DotNet.Interceptors.FeatureGates.Abstractions --version 2.0.117
                    
NuGet\Install-Package Innovabit.DotNet.Interceptors.FeatureGates.Abstractions -Version 2.0.117
                    
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="Innovabit.DotNet.Interceptors.FeatureGates.Abstractions" Version="2.0.117" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Innovabit.DotNet.Interceptors.FeatureGates.Abstractions" Version="2.0.117" />
                    
Directory.Packages.props
<PackageReference Include="Innovabit.DotNet.Interceptors.FeatureGates.Abstractions" />
                    
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 Innovabit.DotNet.Interceptors.FeatureGates.Abstractions --version 2.0.117
                    
#r "nuget: Innovabit.DotNet.Interceptors.FeatureGates.Abstractions, 2.0.117"
                    
#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 Innovabit.DotNet.Interceptors.FeatureGates.Abstractions@2.0.117
                    
#: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=Innovabit.DotNet.Interceptors.FeatureGates.Abstractions&version=2.0.117
                    
Install as a Cake Addin
#tool nuget:?package=Innovabit.DotNet.Interceptors.FeatureGates.Abstractions&version=2.0.117
                    
Install as a Cake Tool

Innovabit.DotNet.Interceptors.FeatureGates.Abstractions

Feature flags on methods for Innovabit.DotNet.Interceptors via a [FeatureGate] attribute. This is the provider-agnostic base: it ships the interceptor, the attribute and the IFeatureGateEvaluator abstraction. Pick a provider to read the flags:

  • Innovabit.DotNet.Interceptors.FeatureGates.FeatureManagement — Microsoft.FeatureManagement.

Why not an if at the top of the method

Because the if cannot be forgotten on the second caller, and because removing the feature later is deleting an attribute rather than hunting through branches for the ones that belong to it.

Usage

services.AddFeatureManagement();

services
    .AddInterceptors()
    .AddFeatureManagementGates();     // or .AddFeatureGateEvaluator<MyEvaluator>()

services.AddScopedWithInterception<ICheckoutService, CheckoutService>();
[FeatureGate("checkout-v2")]                     // the whole class is behind the flag
public class CheckoutService : ICheckoutService
{
    public Task<Order> PlaceAsync(Basket basket) { ... }

    // …and this one is behind a narrower flag of its own.
    [FeatureGate("checkout-v2-express", WhenDisabled = DisabledBehaviour.ReturnDefault)]
    public Task<Order?> PlaceExpressAsync(Basket basket) { ... }
}

[FeatureGate]

Meaning
Feature The flag that has to be on.
WhenDisabled Throw (default) or ReturnDefault.

Throw raises FeatureDisabledException, carrying the operation and the flag. It is the default because a caller that reaches a method behind a flag it does not know about has a bug, and a loud one is easier to find than a silent no-op.

ReturnDefault hands back null, 0, or a completed Task without running the method. Use it where the feature is genuinely optional and the caller is written to cope with nothing coming back.

The attribute works on a method and on a class, where it applies to every method; a method-level gate replaces the class's, so one method can sit behind a narrower flag than the rest of its type. Put it on the implementation, not the interface.

Ordering

The interceptor runs at InterceptorOrders.FeatureGate (25) — almost outermost, and outside auditing (50) on purpose. A method that is switched off did not happen, so there is no attempt worth recording; a call that was refused is a different thing, and that is why authorization sits inside auditing rather than outside it.

Writing an evaluator

public sealed class TenantFeatureGateEvaluator(ITenantContext tenant) : IFeatureGateEvaluator
{
    public ValueTask<bool> IsEnabledAsync(string feature, CancellationToken cancellationToken = default)
        => new(tenant.Current.EnabledFeatures.Contains(feature));
}

services.AddInterceptors().AddFeatureGateEvaluator<TenantFeatureGateEvaluator>();

Decide what an unknown flag means and say so. The bundled provider treats it as off: a typo in a feature name that defaulted to "on" would ship the unfinished feature.

Registering the interceptor without an evaluator makes resolving an intercepted service fail, rather than letting everything through unnoticed.

License

MIT

Product 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 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 is compatible.  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 (2)

Showing the top 2 NuGet packages that depend on Innovabit.DotNet.Interceptors.FeatureGates.Abstractions:

Package Downloads
Innovabit.DotNet.Interceptors.All

Meta-package: every interceptor concern in the suite (logging, validation, caching, notifications, telemetry, audit, authorization, rate limiting, coordination, feature gates, transactions, retry/timeout/circuit breaker/fallback) in one reference. Providers are separate packages — pick the ones you use.

Innovabit.DotNet.Interceptors.FeatureGates.FeatureManagement

Microsoft.FeatureManagement provider for interceptor-based [FeatureGate] methods.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.117 52 10/31/2026
2.0.116 125 10/26/2026
2.0.115 127 10/17/2026
2.0.114 126 10/10/2026
2.0.113 141 10/3/2026
2.0.112 137 9/28/2026
2.0.111 129 9/28/2026
2.0.110 130 9/27/2026
2.0.109 132 9/26/2026
2.0.108 131 9/26/2026
2.0.107 131 9/26/2026
2.0.106 133 9/25/2026
2.0.105 134 9/25/2026
1.0.0.104 135 9/25/2026
1.0.0.103 111 9/25/2026