Question

Using Castle.DynamicProxy, I "simply" would like to get an Interface-Proxy-Without-Target, but... With a default-constructor so I be able to reuse the proxy-type.

UPDATE

I mean doing something like...

var proxy = generator.CreateInterfaceProxyWithoutTarget(typeof(TInterface) ...);
var proxyType = proxy.GetType();
var newproxy = Activator.CreateInstance(proxyType);

...Except that generated type do not implement default-constructor.

My actual context is related to WCF customization, but that's another story.

Was it helpful?

Solution

  1. no, it does not work that way
  2. when you call CreateFooProxy method on proxy generator, your proxy type WILL be reused as long as it is possible. See here for details if you're interested.

If you're doing some kind of WCF customization based on DynamicProxy you might want to check Castle WCF Facility. It uses DynamicProxy and has some very cool capabilities.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top