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

推荐订阅源

云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
The GitHub Blog
The GitHub Blog
月光博客
月光博客
T
Tailwind CSS Blog
小众软件
小众软件
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
B
Blog RSS Feed
博客园 - 司徒正美
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
博客园 - Franky
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Azure Blog
Microsoft Azure Blog
T
The Blog of Author Tim Ferriss
GbyAI
GbyAI
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - 芭蕉

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