views:

44

answers:

1

On a Castle Castle.DynamicProxy.IInvocation, what's the difference between

GetConcreteMethod

GetConcreteMethodInvocationTarget

Method

I read the documentation, but I don't understand the difference, especially between the first two.

I'm guessing that Method is just the MethodInfo for the method on the actual registered type?

+2  A: 
  • GetConcreteMethod returns a closed method on the proxy, closing it in case it has generic parameters. If it is not a generic method it will plainly return the same value as the Method property.

  • GetConcreteMethodInvocationTarget returns the same value as the MethodInvocationTarget property, but in debug builds asserts that it returns a closed method definition.

  • Method returns the MethodInfo of the proxy, not bothering to return a closed generic method.

Does this answer you question?

By the way, I've updated the Xml docs so hopefully they will be a bit more clear.

roelofb
Thank you!! MethodInvocationTarget returns the MethodInfo on the registered service (not closed), correct?
JeffN825
MethodInvocationTarget returns the closed MethodInfo on the target (registered service)
roelofb
Is there a way to get the method on the implementation? Not the proxy.
JeffN825
That's what you use GetConcreteMethodInvocationTarget() or MethodInvocationTarget for
roelofb