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

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -