标签:-o stl without alt option object res sse memory
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. Following are just a few better known and popular usages of DynamicProxy:
If you‘re new to DynamicProxy you can read a quick introduction, browse through description of the core types in the library, or go into more advanced, in detail discussion:
??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.
Out of the box, the DynamicProxy provides several kinds of proxy objects that you can use. They fall into two broad categories:
Inheritance-based proxies are created by inheriting a proxy class. The proxy intercepts calls to virtual members of the class and forwards them to base implementation. In this case, the proxy and proxied object are one. This also means you can‘t create inheritance based proxy for a pre-existing object. There‘s one inheritance-based proxy kind in DynamicProxy.
Composition-based proxy is a new object that inherits from proxied class/implements proxied interface and (optionally) forwards intercepted calls to the target object. DynamicProxy exposes the following composition-based proxy types:
Class proxy with target - this proxy kind targets classes. It is not a perfect proxy and if the class has non-virtual methods or public fields these can‘t be intercepted giving users of the proxy inconsistent view of the state of the object. Because of that, it should be used with caution.
Interface proxy without target - this proxy kind targets interfaces. It does not expect target object to be supplied. Instead, interceptors are expected to provide implementation for all members of the proxy.
Interface proxy with target - as its name implies wraps objects implementing selected interfaces forwarding calls to these interfaces to the target object.
Interface proxy with target interface - this kind of proxy is kind of a hybrid of two other interface proxy kinds. It allows, but not requires target object to be supplied. It also allows the target to be swapped during the lifetime of the proxy. It is not tied to one type of the proxy target so one proxy type can be reused for different target types as long as they implement the target interface.
标签:-o stl without alt option object res sse memory
原文地址:https://www.cnblogs.com/chucklu/p/10894797.html