Innovabit.DotNet.Interceptors.Abstractions
1.0.0.101
See the version list below for details.
dotnet add package Innovabit.DotNet.Interceptors.Abstractions --version 1.0.0.101
NuGet\Install-Package Innovabit.DotNet.Interceptors.Abstractions -Version 1.0.0.101
<PackageReference Include="Innovabit.DotNet.Interceptors.Abstractions" Version="1.0.0.101" />
<PackageVersion Include="Innovabit.DotNet.Interceptors.Abstractions" Version="1.0.0.101" />
<PackageReference Include="Innovabit.DotNet.Interceptors.Abstractions" />
paket add Innovabit.DotNet.Interceptors.Abstractions --version 1.0.0.101
#r "nuget: Innovabit.DotNet.Interceptors.Abstractions, 1.0.0.101"
#:package Innovabit.DotNet.Interceptors.Abstractions@1.0.0.101
#addin nuget:?package=Innovabit.DotNet.Interceptors.Abstractions&version=1.0.0.101
#tool nuget:?package=Innovabit.DotNet.Interceptors.Abstractions&version=1.0.0.101
Innovabit.DotNet.Interceptors.Abstractions
Core building blocks for aspect-oriented programming (AOP) in .NET using
Castle DynamicProxy and
Microsoft.Extensions.DependencyInjection. This is the base package every other
Innovabit.DotNet.Interceptors.* package builds on (logging, validation,
notifications, retry, ...).
What it provides
InterceptorBase— the abstract base for an interceptor (sync,Task/Task<T>andValueTask/ValueTask<T>aware).AddInterceptors()/InterceptorBuilder— register the proxy generator and your interceptors.Add*WithInterception/TryAdd*WithInterception— register a service so its interface is proxied and intercepted. The concrete implementation is kept under a private key, so it can't be resolved — and its interception bypassed — by accident.Add*ClassWithInterception/TryAdd*ClassWithInterception— proxy a service that has no interface (class proxy; onlyvirtualmembers are intercepted).- An ordered, multi-interceptor pipeline:
InterceptorBase.Order,InterceptorOrders(recommended scale) andInterceptorOrderOptions(per-registration overrides). [Sensitive]/[Mask]andIValueRedactor— mark a parameter once and every interceptor in the suite redacts it (see below).- A bundled Roslyn analyzer that flags interceptor attributes with no effect at compile time —
INTX001(attribute on astaticmethod) andINTX002(a parameter attribute such as[DoNotLog]on a method that isn't intercepted).
Install
dotnet add package Innovabit.DotNet.Interceptors.Abstractions
Usage
using Innovabit.DotNet.Interceptors;
public sealed class TracingInterceptor : InterceptorBase
{
public override bool CanIntercept(IInvocation invocation) => true;
public override void ProcessInterceptionSync(IInvocation invocation) => invocation.Proceed();
public override Task ProcessInterceptionAsync(IInvocation invocation) { invocation.Proceed(); return (Task)invocation.ReturnValue!; }
public override Task<TResult> ProcessInterceptionAsync<TResult>(IInvocation invocation) { invocation.Proceed(); return (Task<TResult>)invocation.ReturnValue!; }
}
services.AddInterceptors()
.Register<TracingInterceptor>(); // or Register<T>(order) to place it in the pipeline
// Proxy IMyService so registered interceptors wrap MyService. Anything that depends on
// IMyService — even services registered without interception — receives the proxied instance.
services.AddScopedWithInterception<IMyService, MyService>();
// No interface? Use a class proxy (only virtual members are intercepted; the class must be non-sealed).
services.AddScopedClassWithInterception<MyService>();
The un-proxied
MyServiceis registered under a private key, so consumers must depend onIMyService(or, for class proxies,MyServiceitself) and always get the intercepted instance — there is no publicly resolvable concrete to inject and silently skip the pipeline.
Sensitive data
[Sensitive] and [Mask] mark a parameter — or a return value, with [return: ...] — as
something the interceptors may not write down verbatim. Mark it once and it stays redacted in
logging, auditing, tracing and exception notifications alike, including in features you adopt later:
[Log]
[Audited]
[NotifyOnException]
public Task<Receipt> ChargeAsync(
string orderId,
[Sensitive] string cardHolder, // recorded as ***
[Mask(ShowLast = 4)] string cardNumber) // recorded as ************1111
{ ... }
[Sensitive] |
[Mask] |
|
|---|---|---|
| Recorded as | Placeholder (default ***) |
The value with only ShowFirst/ShowLast characters left visible |
A null value |
Still replaced, so the record never reveals that the secret was missing | Stays null — nothing to hide, no fragment to show |
| Use it for | Passwords, tokens, whole payloads | Values where a fragment is genuinely useful: a card, an e-mail, an IBAN |
A parameter carrying both is treated as [Sensitive] — between "never record this" and "record a
fragment", the stricter rule is the safe reading. [Mask] never reveals a value in full either: if
the visible window would cover the whole value, it is masked entirely, so [Mask(ShowLast = 4)] on
a four-digit PIN does not print it verbatim.
What redaction does not touch
- The call itself. The method receives the real values; only what the interceptors record changes.
- Cache keys.
[Cache]hashes arguments rather than storing them, and redacting first would make two different cards share an entry. Use[CacheKeyIgnore]to shape a key. - Validation.
[Validate]checks the real value, as it must.
These attributes are about what leaves the process in a record, not about hiding values from your own code.
Custom rules
services.AddInterceptors().UseValueRedactor<HashingRedactor>();
Implement IValueRedactor to hash instead of replacing, to keep a format-preserving mask, or to
honour your own data-classification attributes. It is resolved once and must not throw — an
interceptor recording a value is never a good reason to fail the call it is observing.
Pipeline order
When several interceptors are registered they run as a pipeline. InterceptorBase.Order
controls position: lower runs first (outermost); higher runs closer to the intercepted
method. Ties keep registration order. Override per registration with
Register<T>(int order) or SetOrder<T>(int order). See InterceptorOrders for the
recommended scale.
Part of
The Innovabit.DotNet.Interceptors suite —
github.com/Innovabit/dotnet-interceptors.
| Product | Versions 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. |
-
net10.0
- Castle.Core (>= 5.2.1)
- Castle.Core.AsyncInterceptor (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
-
net8.0
- Castle.Core (>= 5.2.1)
- Castle.Core.AsyncInterceptor (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
-
net9.0
- Castle.Core (>= 5.2.1)
- Castle.Core.AsyncInterceptor (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
NuGet packages (15)
Showing the top 5 NuGet packages that depend on Innovabit.DotNet.Interceptors.Abstractions:
| Package | Downloads |
|---|---|
|
Innovabit.DotNet.Interceptors.Logging.Abstractions
Base package for logging using interceptor. |
|
|
Innovabit.DotNet.Interceptors.Collections
Package for some useful interceptors like retry on exception. |
|
|
Innovabit.DotNet.Interceptors.Notifications.Abstractions
Base package for sending notifications when an intercepted method throws an exception. |
|
|
Innovabit.DotNet.Interceptors.Validation.Abstractions
Package for data validation using interceptor. |
|
|
Innovabit.DotNet.Interceptors.Caching.Abstractions
Base package for method result caching using interceptors. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.119 | 118 | 11/14/2026 |
| 2.0.118 | 806 | 11/7/2026 |
| 2.0.117 | 818 | 10/31/2026 |
| 2.0.116 | 768 | 10/26/2026 |
| 2.0.115 | 749 | 10/17/2026 |
| 2.0.114 | 724 | 10/10/2026 |
| 2.0.113 | 762 | 10/3/2026 |
| 2.0.112 | 722 | 9/28/2026 |
| 2.0.111 | 688 | 9/28/2026 |
| 2.0.110 | 702 | 9/27/2026 |
| 2.0.109 | 719 | 9/26/2026 |
| 2.0.108 | 698 | 9/26/2026 |
| 2.0.107 | 763 | 9/26/2026 |
| 2.0.106 | 574 | 9/25/2026 |
| 2.0.105 | 705 | 9/25/2026 |
| 1.0.0.104 | 669 | 9/25/2026 |
| 1.0.0.103 | 542 | 9/25/2026 |
| 1.0.0.102 | 412 | 9/25/2026 |
| 1.0.0.101 | 401 | 9/25/2026 |
| 1.0.0.100 | 402 | 9/25/2026 |