Welcome Guest, you are in: Login

Castle Project


Navigation (Tools)

Search the wiki


Castle DynamicProxy

Modified on 2011/07/09 01:26 by Krzysztof Ko┼║mic Categorized as DynamicProxy


Castle DynamicProxy Logo

Castle DynamicProxy Logo

DynamicProxy generates proxies for your objects that you can use to transparently add or alter behavior to them, provide pre/post processing and many other things. Castle Windsor uses proxies to enable its interception capabilities, or for Typed Factories. NHibernate uses it to provide lazy loading capabilities. Moq and Rhino Mocks both use it to provide their mocking capabilities. These are just a few better known and popular usages of the framework.

Where is Castle.DynamicProxy.dll?

DynamicProxy used to live in its own assembly. As part of changes in version 2.5 it was merged into Castle.Core.dll and that's where you'll find it.

Use of a single ProxyGenerator's instance

If you have a long running process (web site, windows service, etc.) and you have to create many dynamic proxies, you should make sure to reuse the same ProxyGenerator instance. If not, be aware that you will then bypass the caching mechanism. Side effects are high CPU usage and constant increase in memory consumption

See also

ScrewTurn Wiki version Some of the icons created by FamFamFam.