Bundle of lightweight, runtime-flag-toggled ASP.NET Core capabilities. Toggled via
PowerFeatures:<Key>:Enabled. Any built-in can be disabled and replaced by a custom Pluggable Feature.
| Property | Value |
|---|---|
| Package ID | PowerCSharp.BuiltInFeatures |
| Version | $(PowerCSharpFeaturesVersion) |
| Target Framework | net8.0 |
| Dependencies | PowerCSharp.Features, Microsoft.AspNetCore.App |
| NuGet | PowerCSharp.BuiltInFeatures |
Built-in Features (Group 1) are low-complexity ASP.NET Core / pipeline capabilities that:
- Ship together in a single bundle package.
- Carry no third-party dependencies — only ASP.NET Core framework references.
- Are gated by runtime flag only (no package-reference gating).
- Can each be disabled and replaced by a custom Pluggable Feature that provides the same
FeatureKey.
builder.Services.AddPowerFeatures(builder.Configuration, options =>
{
options.AddBuiltInFeatures(); // opts the bundle into auto-discovery
});AddBuiltInFeatures() is an extension on PowerFeaturesOptions that calls ScanAssemblies(typeof(CorsFeatureModule).Assembly).
var app = builder.Build();
app.UsePowerFeatures(); // applies enabled built-ins' middleware in Order| Property | Value |
|---|---|
| Feature Key | Cors |
| Module | CorsFeatureModule |
| Order | 10 |
| Default | Disabled |
Registers and applies a named CORS policy using IApplicationBuilder.UseCors. When disabled, no policy is registered and no middleware is added.
{
"PowerFeatures": {
"Cors": {
"Enabled": true,
"AllowedOrigins": [ "https://example.com", "https://app.example.com" ],
"AllowedMethods": [ "GET", "POST", "PUT", "DELETE" ],
"AllowedHeaders": [ "Authorization", "Content-Type" ],
"AllowCredentials": false
}
}
}POWERFEATURES__CORS__ENABLED=true
public static PowerFeaturesOptions AddBuiltInFeatures(this PowerFeaturesOptions options)Convenience method that opts the PowerCSharp.BuiltInFeatures assembly into auto-discovery. Equivalent to:
options.ScanAssemblies(typeof(CorsFeatureModule).Assembly);Disable the built-in via flag and register your own Pluggable Feature with the same FeatureKey:
{
"PowerFeatures": {
"Cors": { "Enabled": false }
}
}// Your custom CORS module
public class CustomCorsFeatureModule : IFeatureModule
{
public string FeatureKey => "Cors";
public int Order => 10;
// ...
}
builder.Services.AddPowerFeatures(builder.Configuration, options =>
{
options.AddBuiltInFeatures();
options.AddModule(new CustomCorsFeatureModule()); // explicit registration
});The built-in CORS module will be skipped (flag off); your custom module runs instead.
The following are planned for future minor releases:
| Feature Key | Description |
|---|---|
CorrelationId |
Injects/reads a correlation ID header for distributed tracing |
SecurityHeaders |
Adds security response headers (CSP, HSTS, X-Frame-Options, etc.) |
ExceptionHandling |
Global exception handler middleware with structured error responses |
Sanitization |
Request/response body sanitization |
HealthChecks |
Standard ASP.NET Core health check endpoint wiring |
PowerCSharp.Features.md— Features engine API referencePowerCSharp.Features.Architecture.md— Two-tier system designPowerCSharp.Features.Authoring-Guide.md— How to build a new Built-in FeaturePowerCSharp.Features.FlagReference.md— Flag schema and precedence rules