惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
M
MIT News - Artificial intelligence
D
Docker
S
SegmentFault 最新的问题
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
C
Check Point Blog
GbyAI
GbyAI
美团技术团队
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog

博客园 - 芭蕉

Model-View-ViewModel(MVVM) with MEF 使用EnvDTE自动格式整个工程 Inversion of Control Duck Typing in C# - 芭蕉 C# 4.0 Dynamic --通过DLR直接调用IronPython 介绍一个Python进行函数式编程时有用的module - 芭蕉 - 博客园 lambda in F# - 芭蕉 UML类关系图标识速记 Python functions VisualStudio quick tips -- 快速在多个打开的代码文件间切换 VisualStudio quick tips --快速调整字体大小 结合实例实习F#(三)--理解函数式语言中的函数 VisualStudio quick tips --快速打开Properties Page 结合实例学习F#(二) --基本数据类型Discriminated Unions 结合实例学习F#(一) --快速入门 Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance Factory Method 顺时钟方向螺旋状打印矩阵元素 玩转Visual Studio ---Debug篇
Dynamic Proxy
芭蕉 · 2010-01-04 · via 博客园 - 芭蕉

Castle Dynamic Proxy is a library for generating lightweitgh .NET Proxy on the fly at run time.    it worked as generating a subclass  of the given class and overried the virtual method at the run time.

  Limitation:

    1. Cann't generate Proxy for sealed class

    2. Only virtual method can be intercepted.

Key Interface/Type:

  ProxyGenerator : used to generate the proxy

  IInterceptor:  add move behaviors here

  IInvocation: Holds all the infomation about the call

  IProxyTargetAccessor: each generated proxy implements IProxyTargetAccessor, we use it ( with method GetInterceptors()) to get the      interceptor we want

  ProxyGenerationOptions class: used to control how to generate the proxy. it accept a instance of IProxyGenerationHook to enable us to choose which methods we want to intercept,  in addition, it has a property IInterceptorSelector help us to filter  interceptor we want to perform on the method.

    ProxyGenerationOptions has a method called AddMixinInstance to help us implement Mixins.

Tutorials: http://kozmic.pl/Tags/Dynamic%20Proxy/default.aspx