AspectInjector: Yet Another Aspect-Oriented Programming Framework for .NET

Yuriy I. CodeProject. 2016-08-14.
There are cases when aspect-oriented programming is very helpful — for example, logging, auditing, security, etc. Though .NET platform doesn’t have relevant instruments out-of-the-box, there are some third-party solutions providing such capability: PostSharp, Unity, Spring .NET, Castle Windsor, Aspect .NET… And that is not the full list. However, when choosing an AOP framework for a particular task, it is worth thinking about the mechanisms implementing the injection of crosscutting functionality, about their pros and cons. Generally speaking, two approaches can be identified:
•Compile-time injection (PostSharp)
•Proxy-class generation at run-time (Unity, Spring .NET, Castle Windsor)
Compile-time injection is the most favorable option, because it requires no additional computational overhead during program execution, which is especially important for mobile devices. Though usual proxy-class generation has simpler implementation, apart from computational overhead, it also has some limitations — methods and properties must belong to an interface or be virtual in order to be intercepted via a proxy-class.
PostSharp offers great capabilities for aspect-oriented programming, but it is a commercial product, so may be not acceptable for some projects. As an alternative, we have developed and are continuing to improve AspectInjector — a framework, which allows applying aspects during compile-time and has simple but flexible interface.
[AspectInjector: Yet Another Aspect-Oriented Programming Framework for .NET]