AspectCentral.Abstractions 2.0.0-rc.1

This is a prerelease version of AspectCentral.Abstractions.
dotnet add package AspectCentral.Abstractions --version 2.0.0-rc.1
                    
NuGet\Install-Package AspectCentral.Abstractions -Version 2.0.0-rc.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="AspectCentral.Abstractions" Version="2.0.0-rc.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AspectCentral.Abstractions" Version="2.0.0-rc.1" />
                    
Directory.Packages.props
<PackageReference Include="AspectCentral.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 AspectCentral.Abstractions --version 2.0.0-rc.1
                    
#r "nuget: AspectCentral.Abstractions, 2.0.0-rc.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 AspectCentral.Abstractions@2.0.0-rc.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=AspectCentral.Abstractions&version=2.0.0-rc.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AspectCentral.Abstractions&version=2.0.0-rc.1&prerelease
                    
Install as a Cake Tool

AspectCentral.Abstractions

CI NuGet Downloads License: MIT

Common AOP (aspect-oriented programming) abstractions for the AspectCentral family. Defines the IAspectRegistrationBuilder, the [Aspect] attribute, and IServiceCollection extensions that concrete runtime implementations (DispatchProxy, Castle DynamicProxy, …) plug into.

Target frameworks

netstandard2.0 · netstandard2.1 · net9.0 · net10.0

Install

dotnet add package AspectCentral.Abstractions

You also need one of the runtime implementations:

Runtime Backed by Package
AspectCentral.DispatchProxy System.Reflection.DispatchProxy AspectCentral.DispatchProxy
AspectCentral.Interceptors Castle DynamicProxy IInterceptor AspectCentral.Interceptors

Quick start

using AspectCentral.Abstractions;
using Microsoft.Extensions.DependencyInjection;

// 1. Mark your aspect with [Aspect].
[Aspect]
public sealed class LoggingAspect
{
    public void OnBefore(AspectContext ctx) { /* … */ }
    public void OnAfter(AspectContext ctx)  { /* … */ }
}

// 2. Wire AspectCentral into your DI container, using a concrete runtime
//    (TAspectRegistrationBuilder = e.g. DispatchProxyAspectRegistrationBuilder).
var services = new ServiceCollection();

services
    .AddAspectSupport(typeof(DispatchProxyAspectRegistrationBuilder))
    .AddScoped<IGreeter, Greeter>()    // register the service
    .AddAspect<LoggingAspect>();       // attach the aspect to the most-recently-added service

var provider = services.BuildServiceProvider();
var greeter  = provider.GetRequiredService<IGreeter>(); // returns a proxy

Key surface

Type Role
AspectAttribute Marks a type as an aspect. Auto-registered as a singleton by AddAspectSupport.
IAspectRegistrationBuilder Builder contract. Concrete runtimes implement InvokeCreateFactory to produce proxies.
AspectRegistrationBuilder Abstract base with the shared bookkeeping (service add, aspect attach).
AspectRegistrationBuilderExtensions AddScoped / AddTransient / AddSingleton / AddAspect<T>() helpers.
AspectCentralServiceCollectionExtensions AddAspectSupport entry point. Lives in the Microsoft.Extensions.DependencyInjection namespace.
AspectContext Per-invocation context: target method, args, return value, InvokeMethod short-circuit flag.
AspectException + AspectErrorCodes Domain exception with stable codes (AC001AC004).
AspectCentralDiagnostics Well-known ActivitySourceName / MeterName for downstream runtimes.

Versioning

Built with Nerdbank.GitVersioning. The version flows from src/version.json plus the git height of the current commit.

Publish flow:

Trigger Job Version Destination
Push to feature/**, develop, master build-test …-alpha.{height}+ci.{run} Workflow artifact only — not published to nuget.org
Push to release/** publish-rc …-rc.{height} Signed, published to nuget.org
Tag v* on master publish-stable exact match of version.json Signed, published to nuget.org

Release-branch checklist. When cutting release/X.Y.Z, the first commit on the release branch must bump src/version.json's version field from X.Y.Z-alpha.{height} to X.Y.Z-rc.{height} and promote PublicAPI.Unshipped.txt content into PublicAPI.Shipped.txt. The publish-rc job refuses to publish a release-branch build that does not match *-rc.*.

Breaking changes in 2.0.0

Area Change
Naming IServiceCollectionExtensionsAspectCentralServiceCollectionExtensions (now in Microsoft.Extensions.DependencyInjection namespace).
Naming IAspectRegistrationBuilderExtensionsAspectRegistrationBuilderExtensions.
Errors AddAspect before any service is registered now throws AspectException(AspectErrorCodes.NoServiceRegisteredForAspect) instead of InvalidOperationException.
Errors AddAspectSupport(Type) with a non-IAspectRegistrationBuilder argument now throws AspectException(AspectErrorCodes.InvalidRegistrationBuilderType) instead of ArgumentException.
TFMs Drops net5.0; adds netstandard2.0, net9.0, net10.0.
Deps Microsoft.Extensions.DependencyInjection.Abstractions 5.0.0 → 10.0.0.

Contributing

See AGENTS.md for the universal contribution rules (vertical slices, BDD/TDD, security, observability) and src/AGENTS.md for the library-specific checklist. GitFlow: branch off develop (feature/…), open a PR into develop. master is the stable publishing branch.

License

MIT — see LICENSE.

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 was computed.  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. 
.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 is compatible. 
.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 (1)

Showing the top 1 NuGet packages that depend on AspectCentral.Abstractions:

Package Downloads
AspectCentral.DispatchProxy

Aspect-oriented programming for Microsoft.Extensions.DependencyInjection built on System.Reflection.DispatchProxy. Wrap registered services with logging, profiling, or custom aspects without changing call sites; consumers configure their own logging sinks and OpenTelemetry exporters.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0-rc.1 137 5/20/2026
1.0.2 999 11/12/2021
1.0.1 731 10/15/2021
1.0.0 566 10/14/2021
1.0.0-alpha900008 622 7/2/2020
1.0.0-alpha900007 669 7/2/2020
1.0.0-alpha900005 749 4/6/2020
1.0.0-alpha900004 636 12/13/2019
1.0.0-alpha900003 609 9/28/2019
1.0.0-alpha900001 632 9/26/2019
1.0.0-alpha9 656 9/7/2019
1.0.0-alpha8 644 9/7/2019
1.0.0-alpha7 658 9/1/2019
1.0.0-alpha6 778 8/29/2019
1.0.0-alpha5 657 8/24/2019
1.0.0-alpha4 799 8/17/2019
1.0.0-alpha3 637 8/17/2019