Seven implementation methods of AOP in. NET and seven implementation methods of aop.net

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.