• AOP在 .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

  • 相关阅读:
    IOS sqlite数据库增删改查
    宏定义偷懒型set,get
    创业白手起家也须要条件——北漂18年(14)
    Python模拟登录wap版百度贴吧+自己主动回贴
    纯CSS制作冒泡提示框
    tiny210(s5pv210)移植u-boot(基于 2014.4 版本号)——移植u-boot.bin(打印串口控制台)
    ZOJ 3587 扩展KMP
    用选择法对10个整数按从小到大排序(数组)
    设计一个算法,推断一个二叉树是否为全然二叉树
    Hibernate学习笔记(八) — 懒载入与抓取策略
  • 原文地址:https://www.cnblogs.com/ranran/p/4164179.html
Copyright © 2020-2023  润新知