access an actual object of ContextboundObject in sink class?

  • Thread starter Thread starter pinetaj
  • Start date Start date
P

pinetaj

Hello,
I'd like to intercept some method invocations on certain object.
For the object, I wrote a class inherited from ContextBoundObject.
and also related classes to implement attribute, property, sink classes
required to intercept the method invocations.

The property created for the context implements IContributeObjectSink
(for GetObjectSink) so the each object's activity can be intercepted.
I want to access the actual object when sink class's methods get
executed during interception.
But, I found the sink returns MarshalByRefObject's TransparentProxy
instead of the actual object represented by the transparentProxy.

Is there any way to let the sink class's method access the actual
object which is the target of the interception?

Any advice will be helpful.
Thank you so much.
 
pinetaj,

All you have to do is cast the object to the type you expect and then
you will be able to call the methods on it. The MarshalByRefObject is
passed because it is the subtype that all ContextBoundObjects have to derive
from.

Hope his helps.
 
Back
Top