This helped me a lot, I was trying to achieve the same thing.
Basically, for certain interfaces I want the container to créate proxies
for me, where the logic of each member (all of them are methods) is
resolved in a generic way by an interceptor. The interceptor does all the
work (it actually uses the container to get a "handler" to deal with the
method), but I don't need a target after the interceptor has run. This
works for me, just wish it was simpler:
var model =
container.Kernel.GetHandler(componentJustRegistered).ComponentModel;
ProxyUtil.ObtainProxyOptions(model, true).OmitTarget = true;
Thanks!
El lunes, 7 de febrero de 2011 11:55:41 UTC-3, Nick Peeples escribió:
> Sorry for the long time between responses, busy week that last one.
>
> Krzysztof, that did help. Just the confirmation that you can't create and
> return a proxy through a factory method was enough so that I could abandon
> trying that route.
>
> I have enabled the functionality that I need with an Interceptor as
> someone else mentioned, which is essentially what I was attempting in the
> first place. The one thing I had to dig into was to set .OmitTarget like
> this:
>
> ProxyUtil.ObtainProxyOptions(model, true).OmitTarget =
> true;
>
> After I did that, the desired functionality is achieved with a simple
> Component.For<IInterface>();
>
> - Nick
>
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/castle-project-users/-/ziJcb93pF2EJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.