1
Vote

Consider Going From IInvocationHandler to Delegates (Or Making That Another Hooking Option)

description

Right now, the IInvocationHandler approach is not type-safe. That is, the arguments and return types are are declared as "object". Furthermore, the user may want to hook just a handful of methods.
 
Therefore, maybe it's better to give an alternative approach where the user says something like this:
 
Proxy.Create<MyType>(myType, new MethodHookMapping(...));
 
Where MethodHookMapping has a list of methods in the given type and an associated pair of before- and after-invocation delegates. This would make the callbacks strongly-typed.
 
I have no idea how this would work just yet but it may be a nice feature :)

comments