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. Oracle对表解锁的操作

    1.查出被锁的表 SELECT  lpad(' ',decode(l.xidusn ,0,3,0))||l.oracle_username User_name, o.owner,o.object_na ...

  2. 《App研发录》知识点汇总

    原文链接:http://www.jianshu.com/p/fc8c4638937e <App研发录>这部书是包建强写的,说来也巧,在读这边书之前在看池建强的<Mac 人生元编程&g ...

  3. windbg配置问题汇总

    .loadby sos.dll mscorwks.symfix c:\windows\symbols windbg配置问题汇总 1.Failed to find runtime DLL (clr.dl ...

  4. Mysql group by 排序问题

    类如 有一个 帖子的回复表,posts( id , tid , subject , message , dateline ) , id 为 自动增长字段, tid为该回复的主题帖子的id(外键关联), ...

  5. php 导出csv

    public function doworks(){        //输出Excel文件头,可把user.csv换成你要的文件名        header('Content-Type: appli ...

  6. hdu1150

    [ Reprinted ]最小点覆盖=最大二分匹配数 url: http://zhidao.baidu.com/link?url=ZMzk27V8P99KQN63DpVsE2fd1YBIk7Jg83E ...

  7. js动态改变图片热区坐标,手机端图片热区自适应

    <img id='banner1' src="images/banner.jpg" usemap="#banner" border="0&quo ...

  8. MallBuilder 多用户商城管理系统 v5.8.1.1

    MallBuilder是一款基于PHP+MYSQL的多用户网上商城解决方案.利用MallBuilder可以快速建立一个功能强大的类似京东商城.天猫商城.1号店商城的网上商城,或企业.行业化.本地化和垂 ...

  9. linux内核中的min(x, y)和max(x, y)宏定义

    /linux/include/linux/kernel.h中有min(x, y)和max(x, y)的定义如下: #define min(x, y) ({ \ typeof(x) _min1 = x; ...

  10. PeopleCode 处理压缩文件

     PeopleSoft中对文件附件的处理都是单个文件处理的,虽然在8.52版本新增了MAddAttachment(URLDestination, DirAndFilePrefix, Prompts, ...