Innovabit.DotNet.Interceptors.Abstractions 1.0.0.100

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

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> and ValueTask/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; only virtual members are intercepted).
  • An ordered, multi-interceptor pipeline: InterceptorBase.Order, InterceptorOrders (recommended scale) and InterceptorOrderOptions (per-registration overrides).
  • A bundled Roslyn analyzer that flags interceptor attributes with no effect at compile time — INTX001 (attribute on a static method) and INTX002 (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 MyService is registered under a private key, so consumers must depend on IMyService (or, for class proxies, MyService itself) and always get the intercepted instance — there is no publicly resolvable concrete to inject and silently skip the pipeline.

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 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 (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
Loading failed