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 side of 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 heavy weight
Can only be used on interfaces or MarshalByRefObjects

微显重量级

仅在接口或 MarshalByRefObjects 上使用

Deriving from ContextBoundObject

从 ContextBoundObject 派生

Easiest to implement
Native support for call interception

很容易实现

原生支持调用拦截

Very costly in terms of performance

非常昂贵的性能代价

Compile-time subclassing
( Rhino Proxy )

编译时子类化

Easiest to understand

很容易理解

Interfaces or virtual methods only

仅用于接口或虚方法

Runtime subclassing
( Castle Dynamic Proxy )

运行时子类化

Easiest to understand
Very flexible

很容易理解

非常灵活

Complex implementation (but already exists)
Interfaces or virtual methods only

复杂的实现(已经实现)

仅用于接口或虚方法

Hooking into the profiler API
( Type Mock )

分析 API 钩子

Extremely powerful

极端强大

Performance?
Complex implementation (COM API, require separate runner, etc)

性能未知

复杂实现(COM API,需要单独运行等)

Compile time IL-weaving 
( Post Sharp / Cecil )

编译时 IL 织入

Very powerful
Good performance

非常强大

良好的性能

Very hard to implement

实现非常困难

Runtime IL-weaving
( Post Sharp / Cecil )

运行时 IL 织入

Very powerful
Good performance

非常强大

良好的性能

Very hard to implement

实现非常困难

文献来源:http://ayende.com/blog/2615/7-approaches-for-aop-in-net

AOP在 .NET中的七种实现方法的更多相关文章

  1. C#中的两种debug方法

    这篇文章主要介绍了C#中的两种debug方法介绍,本文讲解了代码用 #if DEBUG 包裹.利用宏定义两种方法,需要的朋友可以参考下   第一种:需要把调试方法改成debug代码用 #if DEBU ...

  2. SuperDiamond在JAVA项目中的三种应用方法实践总结

    SuperDiamond在JAVA项目中的三种应用方法实践总结 1.直接读取如下: @Test public static void test_simple(){ PropertiesConfigur ...

  3. js oop中的三种继承方法

    JS OOP 中的三种继承方法: 很多读者关于js opp的继承比较模糊,本文总结了oop中的三种继承方法,以助于读者进行区分. <继承使用一个子类继承另一个父类,子类可以自动拥有父类的属性和方 ...

  4. 将dll文件注入到其他进程中的一种新方法

    http://www.45it.com/windowszh/201212/33946.htm http://www.hx95.cn/Article/OS/201212/65095.html 我们知道将 ...

  5. http协议中客户端8种请求方法

    http请求中的8种请求方法 1.opions   返回服务器针对特定资源所支持的HTML请求方法   或web服务器发送*测试服务器功能(允许客户端查看服务器性能) 2.Get   向特定资源发出请 ...

  6. JS中的五种去重方法

    JS中的五种去重方法 第一种方法: 第二种方法:  第三种方法: 第四种方法: 第五种方法:优化遍历数组法 思路:获取没重复的最右一值放入新数组 * 方法的实现代码相当酷炫,* 实现思路:获取没重复的 ...

  7. java 中的几种 "通用方法“

    前言 Java中,除了基本的数值类型,其他所有数据类型(包括数组)都是对象. 而Object这个类是所有类的超类,它提供的方法,自然能够使用于它的所有子类(所有非基本数值类型). 本文介绍了Objec ...

  8. java数组中的三种排序方法中的冒泡排序方法

    我记得我大学学java的时候,怎么就是搞不明白这三种排序方法,也一直不会,现在我有发过来学习下这三种方法并记录下来. 首先说说冒泡排序方法:冒泡排序方法就是把数组中的每一个元素进行比较,如果第i个元素 ...

  9. objective-c数组的七种遍历方法总结

    //第一种 [arr enumerateObjectsUsingBlock: ^(id obj, NSUInteger idx, BOOL *stop){     NSLog(@"%ld,% ...

随机推荐

  1. 使用POI导入Excel异常Cannot get a text value from a numeric cell 解决

    POI操作Excel时因为Excel数据Cell有不同的类型,会出现Cannot get a text value from a numeric cell的异常错误. 异常原因:Excel数据Cell ...

  2. 用C#访问Dynamic AX的WebService.

    第 1 步:创建 C# WinForm 应用程序 针对本演练,您将创建访问报表服务器 Web 服务的简单控制台应用程序.本演练假定您是在 Visual Studio 环境中进行开发的.测试范例基于VS ...

  3. PHP超时处理全面总结(转)

    [ 概述 ] 在PHP开发中工作里非常多使用到超时处理到超时的场合,我说几个场景: 1. 异步获取数据如果某个后端数据源获取不成功则跳过,不影响整个页面展现 2. 为了保证Web服务器不会因为当个页面 ...

  4. 添加favicon.ico网站文件

    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" me ...

  5. 条款20 STL函数对象

    继承标准STL的函数对象 1: struct PopLess : public atd::binary_function<state,state,bool> 2: { 3: bool op ...

  6. Android开发教程app下载无法成功创建问题

    本文明来给各位同学介绍一下关于cordova cteate app 时下载失败无法成功创建的解决方法,有碰到此问题的同学可进入参考. 使用如下语句创建一个cordova应用: 代码如下 cordova ...

  7. linu流量监控

    iftophttp://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858923.html 默认是监控第一块网卡的流量iftop 监控eth1iftop ...

  8. MVC5 Identity 用用户名登录而不用电子邮件

    1.修改AccountViewModels ·修改RegisterViewModel public class RegisterViewModel { [Required] [Display(Name ...

  9. C# 随机颜色的方法

    public string GetRandomColor() { Random RandomNum_First = new Random((int)DateTime.Now.Ticks); // 对于 ...

  10. 如何保护java程序不被反编译

    Java是一种 跨平台的.解释型语言 Java 源代码编译中间“字节码”存储于class文件中.Class文件是一种字节码形式的中间代码,该字节码中包括了很多源代码的信息,例如变量名.方法名 等.因此 ...