CasCap.Common.AspNetCore 4.12.7

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

CasCap.Common.AspNetCore

ASP.NET Core helpers for the CasCap feature-flag system — feature-gated controller discovery.

Installation

dotnet add package CasCap.Common.AspNetCore

Purpose

In a modular monolith the whole controller surface compiles into one process, but each deployment (pod/host) typically enables only a subset of features (see CasCap.Common.Services / FeatureFlagConfig.EnabledFeatures) and registers only that subset's services. Without gating, every controllers-enabled host maps every controller and returns HTTP 500 when a controller's feature-scoped dependency is not registered — and advertises endpoints in Swagger it cannot actually serve.

Mark a controller with [FeatureController(...)] and call AddFeatureGatedControllers(enabledFeatures) so the controller is only routed (and shown in OpenAPI/Swagger) on hosts where one of its features is enabled. Unmarked controllers are always available (their dependencies must be registered on every host that maps controllers).

This is the single-assembly (type-level) equivalent of gating controllers by ApplicationPart at the assembly level. Prefer assembly-level gating (AddApplicationPart per enabled feature) when each feature's controllers live in their own assembly, since that also avoids loading off-feature assemblies.

Target frameworks: net8.0, net9.0, net10.0

Usage

// Controller — only mapped where the PafGen feature is enabled:
[ApiController]
[FeatureController(FeatureNames.PafGen)]
[Route("api/v{version:apiVersion}/paf/srzone")]
public sealed class SrZoneController(IPafPlotCollectionSource source) : ControllerBase { /* ... */ }

// Composition root:
builder.Services.AddControllers()
    .AddFeatureGatedControllers(enabledFeatures); // same set passed to AddFeatureFlagService(...)

Types

Type Description
FeatureControllerAttribute Marks a controller with the feature name(s) that must be enabled for it to be discovered. Unmarked = always available
FeatureGatedControllerFeatureProvider IApplicationFeatureProvider<ControllerFeature> that prunes marked controllers whose feature is not enabled on the host

Extensions

Extension Description
MvcBuilderExtensions.AddFeatureGatedControllers() Adds the FeatureGatedControllerFeatureProvider to the MVC application-part manager for the supplied enabled-feature set

Dependencies

Framework References

Reference Purpose
Microsoft.AspNetCore.App ASP.NET Core MVC application-part / controller-feature types (IApplicationFeatureProvider<ControllerFeature>, IMvcBuilder)
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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

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
4.12.7 41 9/4/2026
4.12.6 41 9/1/2026
4.12.5 105 8/20/2026
4.12.4 84 8/18/2026