c# - Unity Interception: How to pass parameter into ICallHandler implementation? -
c# - Unity Interception: How to pass parameter into ICallHandler implementation? -
can pass message parameter icallhandler implementation this:
var logic = container.resolve<ibussinesslogic>(message);
and utilize this:
imethodreturn icallhandler.invoke(imethodinvocation input, getnexthandlerdelegate getnext) { console.writeline( string.format( "begin {0} param {1}", input.methodbase.name, message // parameter need passed ) ); var result = getnext.invoke()(input, getnext); console.writeline("end " + input.methodbase.name); homecoming result; }
?
the message
you're passing resolve
method named instance name unity construct. value used unity select implementation of ibusinesslogic
use; after construction of implementing object lost.
this value hence within unity during object's construction; icallhandler
cannot access you cannot intercept constructors.
c# unity-container interception unity-interception
Comments
Post a Comment