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
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.
- If you're new to DynamicProxy you can read a quick introduction.
- Browse through description of the core types in the library.
- Go into more advanced, in detail discussion.
DynamicProxy used to live in its own assembly. As part of changes in version 2.5 it was merged into
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