Sanitization feature module, options, and DI/ASP.NET Core wiring for the PowerCSharp Sanitization feature.
Pair this package with PowerCSharp.Feature.Sanitization.Abstractions (engine + contracts + NoOp). Unlike the Cache feature family, Sanitization has no swappable-backend provider package — this module registers the concrete implementation directly.
SanitizationFeatureOptions— options bound fromPowerFeatures:Sanitization, mirroring the fullSanitizationSettingssurface.SanitizationFeatureModule— auto-discoverable module; registers the real service when enabled,NoOpSanitizationServicewhen disabled.SanitizationService— the DI-facingISanitizationServiceimplementation, delegating to the engine.SanitizationSettingsProvider— bridges bound options intoSanitizationSettingsfor the engine.SanitizationFeatureExtensions.AddSanitizationFeature— explicit registration extension; registers the real service directly (no NoOp floor, since there is no separate provider package to defer to).SanitizationEngineServiceProviderExtensions.ConfigureSanitizationEngine— wires the DI-resolved settings provider into the staticSanitizationEngine, so extension-method call sites (input.SanitizeForLog()) also reflect host configuration.
PowerCSharp.Feature.Sanitization— options, module, service, and extension methods.
The engine, contracts, and NoOp implementation live in
PowerCSharp.Feature.Sanitization.Abstractions.
using PowerCSharp.Feature.Sanitization;
builder.Services.AddPowerFeatures(builder.Configuration, o =>
o.ScanAssemblies(typeof(SanitizationFeatureModule).Assembly));
var app = builder.Build();
app.UsePowerFeatures(); // also wires the static engine via ConfigurePipelineusing PowerCSharp.Feature.Sanitization;
builder.Services.AddSanitizationFeature(builder.Configuration);
var app = builder.Build();
app.Services.ConfigureSanitizationEngine(); // wire the static engine explicitly{
"PowerFeatures": {
"Sanitization": {
"Enabled": true,
"EnableLogSanitization": true,
"EnableFilePathSanitization": true,
"EnableSensitiveDataDetection": true,
"EnableRegexSanitization": true
}
}
}Then resolve ISanitizationService from DI, or call the extension methods in PowerCSharp.Feature.Sanitization.Abstractions directly — both reflect the same configuration once ConfigureSanitizationEngine has run.
- Package ID:
PowerCSharp.Feature.Sanitization - Depends on:
PowerCSharp.Features.Abstractions+PowerCSharp.Feature.Sanitization.Abstractions - Target framework:
net8.0(requires ASP.NET Core host) - See:
docs/PowerCSharp.Features.Authoring-Guide.md,docs/PowerCSharp.Feature.Sanitization.md
