ZibStack.NET.Aop.Abstractions 3.1.1

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

ZibStack.NET.Aop

AOP framework for .NET 8+ using C# interceptors — define aspects that run before, after, or around any method at compile time. No runtime proxy, no reflection.

Install

dotnet add package ZibStack.NET.Aop

Built-in Aspects

All registered automatically by AddAop():

Attribute What it does
[Trace] OpenTelemetry Activity spans with parameter tags, timing, status
[Log] Structured entry/exit/error logging via ILoggerFactory (from ZibStack.NET.Log.Abstractions)
[Retry] Retry with backoff + exception filtering (Handle/Ignore as Type[])
[Cache] In-memory cache with TTL and compile-time KeyTemplate
[Metrics] System.Diagnostics.Metrics — call count, duration histogram, error count
[Timeout] Async execution time limit, throws TimeoutException
[Authorize] Policy/role-based auth via IAuthorizationProvider
[Debounce] Quiet-period delay — rapid calls collapse into a single execution
[Throttle] Rate limiting — at most one call per interval, optional trailing fire

Bulk Apply (no attributes needed)

Apply aspects to entire namespaces, interfaces, or base classes — no per-method attributes required:

public sealed class AopConfig : IAopConfigurator
{
    public void Configure(IAopBuilder b)
    {
        // Log every public method in a namespace — zero attributes on classes
        b.Apply<LogAttribute>(to => to
            .Namespace("MyApp.Services")
            .PublicMethods()
        );

        b.Apply<TraceAttribute>(to => to
            .Namespace("MyApp.Services")
            .PublicMethods()
        );

        b.Apply<CacheAttribute>(to => to
            .Implementing<IRepository>()
            .PublicMethods()
        , c => c.DurationSeconds = 120);

        b.Apply<RetryAttribute>(to => to
            .Namespace("MyApp.External")
            .MethodsWhere(m => m.IsAsync)
        , r => r.MaxAttempts = 5);
    }
}

Selectors: .Namespace(), .Implementing<T>(), .DerivedFrom<T>(), .ClassesWhere(), .MethodsWhere(), .PublicMethods(), .Except<T>().

Works with interfaces, generics, overloads, diamond inheritance, and DI dispatch.

Optional (require external packages): [PollyRetry] (Polly.Core), [HybridCache] (Microsoft.Extensions.Caching.Hybrid).

// One attribute per concern:
[Trace]
[Log]
[Retry(MaxAttempts = 3, Handle = new[] { typeof(HttpRequestException) })]
[Cache(KeyTemplate = "order:{id}", DurationSeconds = 60)]
[Metrics]
public async Task<Order> GetOrderAsync(int id) { ... }

Setup

using ZibStack.NET.Aop;

builder.Services.AddAop();                       // registers all built-in handlers
builder.Services.AddTransient<MyHandler>();       // your own handlers

var app = builder.Build();
app.Services.UseAop();                           // bridges DI into the aspect runtime — required

Custom aspects

[AspectHandler(typeof(TimingHandler))]
public class TimingAttribute : AspectAttribute { }

public class TimingHandler : IAspectHandler
{
    public void OnBefore(AspectContext ctx)
        => Console.WriteLine($"Before {ctx.MethodName}");
    public void OnAfter(AspectContext ctx)
        => Console.WriteLine($"After {ctx.MethodName} in {ctx.ElapsedMilliseconds}ms");
    public void OnException(AspectContext ctx, Exception ex)
        => Console.WriteLine($"Error in {ctx.MethodName}: {ex.Message}");
}

// Apply anywhere:
[Timing]
public Order GetOrder(int id) { ... }

Also supported: IAroundAspectHandler<T> (strongly-typed), IAsyncAspectHandler, IAsyncAroundAspectHandler, dual sync+async interfaces, class-level aspects, multi-aspect stacking with Order.

Documentation

Full documentation: mistykuu.github.io/ZibStack.NET/packages/aop/

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on ZibStack.NET.Aop.Abstractions:

Package Downloads
ZibStack.NET.Aop

AOP source generator for .NET. Supports compile-time inline aspects and runtime IAspectHandler. Built on C# interceptors.

ZibStack.NET.Aop.HybridCache

HybridCache aspect for ZibStack.NET.Aop — [HybridCache] with L1/L2 caching (memory + Redis/distributed) via Microsoft.Extensions.Caching.Hybrid.

ZibStack.NET.Aop.Polly

Polly-based resilience aspects for ZibStack.NET.Aop — [PollyRetry] and [HttpRetry] with exponential backoff, exception filtering, named pipelines, and transient HTTP error handling.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.2.4 175 4/21/2026
3.2.3 230 4/21/2026
3.2.2 215 4/21/2026
3.2.1 232 4/21/2026
3.2.0 220 4/21/2026
3.1.5 221 4/20/2026
3.1.4 224 4/20/2026
3.1.3 231 4/20/2026
3.1.2 240 4/20/2026
3.1.1 225 4/20/2026
3.1.0 232 4/20/2026
3.0.6 248 4/20/2026
3.0.5 226 4/20/2026
3.0.4 227 4/20/2026
3.0.3 228 4/20/2026
3.0.2 234 4/20/2026
3.0.1 234 4/20/2026
3.0.0 240 4/20/2026
2.82.0 233 4/20/2026
2.8.1 233 4/18/2026
Loading failed