A high-performance Aspect-Oriented Programming (AOP) framework for .NET
Welcome to BeyondNet.Aop! This framework allows you to implement cross-cutting concerns (such as logging, retries, caching, etc.) cleanly and efficiently using .NET's native DispatchProxy, augmented with high-performance caching for reflection and dynamic compilation.
# Core AOP library
dotnet add package BeyondNetCode.Shell.Aop
# Pre-built aspects (retry, logging, etc.)
dotnet add package BeyondNetCode.Shell.Aop.Aspects
# Serilog integration (recommended for observability)
dotnet add package BeyondNetCode.Shell.Aop.Aspects.Logger.Serilog
# Dependency Injection installer
dotnet add package BeyondNetCode.Shell.Aop.DI| Package | Description | NuGet |
|---|---|---|
BeyondNetCode.Shell.Aop | Core AOP abstractions and executor | link |
BeyondNetCode.Shell.Aop.Aspects | Pre-built retry, logger, and advice aspects | link |
BeyondNetCode.Shell.Aop.Aspects.Logger | Common.Logging integration | link |
BeyondNetCode.Shell.Aop.Aspects.Logger.Serilog | Serilog integration with structured logging | link |
BeyondNetCode.Shell.Aop.DispatchProxy | Native DispatchProxy-based proxy creation | link |
BeyondNetCode.Shell.Aop.DI | Microsoft.Extensions.DependencyInjection extensions | link |
// 1. Define your aspect attribute[AttributeUsage(AttributeTargets.Method)]publicclassRetryAttribute:AbstractAspectAttribute{publicintMaxRetries{get;set;}=3;publicintDelayMs{get;set;}=1000;}// 2. Implement your aspectpublicclassRetryAspect:OnMethodBoundaryAspect<RetryAttribute>{protectedoverridevoidOnEntry(IJoinPointjoinPoint){Console.WriteLine($"Entering {joinPoint.MethodInfo.Name}");}protectedoverridevoidOnException(IJoinPointjoinPoint,Exceptionex){// Implement retry logic}}// 3. Apply to your interfacepublicinterfaceIMyService{[Retry(MaxRetries=3)]Task<string>DoSomethingAsync();}// 4. Register in DIservices.AddAopAspects(typeof(IMyService).Assembly);For detailed documentation, see the language-specific README files:
If you were using Ums.Shell.Aop, update your NuGet references:
# Before (Ums.Shell.Aop)
dotnet add package Ums.Shell.Aop
# After (BeyondNetCode.Shell.Aop)
dotnet add package BeyondNetCode.Shell.AopUpdate namespaces in your code:
// BeforeusingUms.Shell.Aop;// AfterusingBeyondNetCode.Shell.Aop;See CONTRIBUTING.md for GitFlow workflow, commit conventions, and coding standards.
See VERSIONING.md for SemVer strategy and release process.
Licensed under the Apache 2.0 License. See LICENSE for details.
See DISCLAIMER.md for original code authorship attribution.