.NET AOP(一)七種AOP實現方法
7Approaches for AOP in .Net
AOP在 .NET中的七種實現方法
Here are all the ways that I can think of to add AOPto your application. This mostly focus on the interception sideof things,because once you have that, everything else it just details.
在這裡列表了我想到的在你的應用程式中加入AOP支援的所有方法。這裡最主要的焦點是攔截,因為一旦有了攔截其它的事情都是細節。
Approach 方法 |
Advantages 優點 |
Disadvantages 缺點 |
Remoting Proxies 遠端代理 |
Easy to implement, because of the .Net framework support 容易實現,因為有.NET框架的支援。 |
Somewhat heavyweight 微顯重量級 僅在介面或MarshalByRefObjects 上使用 |
Derivingfrom ContextBoundObject 從ContextBoundObject 派生 |
Easiest to implement 很容易實現 原生支援呼叫攔截 |
Very costly in terms of performance 非常昂貴的效能代價 |
Compile-time subclassing 編譯時子類化 |
Easiest to understand 很容易理解 |
Interfaces or virtual methods only 僅用於介面或虛方法 |
Runtime subclassing 執行時子類化 |
Easiest to understand 很容易理解 非常靈活 |
Complex implementation (but alreadyexists) 複雜的實現(已經實現) 僅用於介面或虛方法 |
Hooking into the profiler API 分析 API鉤子 |
Extremely powerful 極端強大 |
Performance? 效能未知 複雜實現(COM API,需要單獨執行等) |
Compile time IL-weaving 編譯時 IL織入 |
Very powerful 非常強大 良好的效能 |
Very hard to implement 實現非常困難 |
Runtime IL-weaving 執行時 IL織入 |
Very powerful 非常強大 朗好的效能 |
Very hard to implement 實現非常困難 |
http://www.cnblogs.com/tenghoo/archive/2010/12/22/aop.html#commentform點選開啟鏈