Seven implementation methods of AOP in. NET and seven implementation methods of aop.net
7 Approaches for AOP in. Net
Seven methods for Implementing AOP in. NET
Here are all the ways that I can think of to add AOPto your application. This mostly focus on the interception side of things, because once you have that, everything else it just details.
Here we list all methods that I have come up with to add AOP support to your application. The main focus here is intercept, because once there is intercept, other things are details.
Approach Method |
Advantages Advantages |
Disadvantages Disadvantages |
Remoting Proxies Remote proxy |
Easy to implement, because of the. Net framework support It is easy to implement because it is supported by the. NET Framework. |
Somewhat heavy weight Can only be used on interfaces or your albyrefobjects Microexplicit Heavyweight Only used on the interface or MarshalByRefObjects |
Deriving from ContextBoundObject Derived from ContextBoundObject |
Easiest to implement Native support for call interception Easy to implement Native support for call interception |
Very costly in terms of performance Very expensive Performance |
Compile-time subclassing (Rhino Proxy) Subclass during compilation |
Easiest to understand Easy to understand |
Interfaces or virtual methods only Used only for interfaces or virtual Methods |
Runtime subclassing (Castle Dynamic Proxy) Runtime subclass |
Easiest to understand Very flexible Easy to understand Very flexible |
Complex implementation (but already exists) Interfaces or virtual methods only Complex implementation (implemented) Used only for interfaces or virtual Methods |
Hooking into the profiler API (Type Mock) Analysis API hook |
Extremely powerful Extremely powerful |
Performance? Complex implementation (com api, require separate runner, etc) Unknown Performance Complex implementation (com api, which must be run separately) |
Compile time IL-weaving (Post Sharp/Cecil) Compiled by IL |
Very powerful Good performance Very powerful Good performance |
Very hard to implement Implementation is very difficult |
Runtime IL-weaving (Post Sharp/Cecil) Run-Time IL woven |
Very powerful Good performance Very powerful Good performance |
VeryHard to implement Implementation is very difficult |
Source: http://ayende.com/blog/2615/7-approaches-for-aop-in-net