views:

64

answers:

1

Hi all,

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.

+1  A: 
  1. no, it does not work that way
  2. when you call Create*Foo*Proxy 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.

Krzysztof Koźmic
Thank you Krzysztof,I took a quick look at WCF Facility, this could help, but there's so few doc...I need self-hosting and in-code only configuration capabilities.
fredlegrain
See here for docs, and the link there. http://using.castleproject.org/display/IoC/Windsor+WCF+integration+facilityThis page will be updated with some actual documentation hopefully soon :)
Krzysztof Koźmic
I think I know what you mean... :)
fredlegrain
at the moment due to spam public registration was put on hold, but if you'd like to contribute to the effort, let me know and I'll set up an account for you :)
Krzysztof Koźmic
This looks like a good idea... But I don't know how WCF Facility works and I will managed making my own WCF customization (I have limited needs). If you have little time, I would suggest adding more in-code xml documentation, that would be great with good effort/result ratio :)
fredlegrain