PC Review


Reply
Thread Tools Rate Thread

access an actual object of ContextboundObject in sink class?

 
 
pinetaj
Guest
Posts: n/a
 
      18th Jun 2006

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.

 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      18th Jun 2006
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.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"pinetaj" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
possible to sink a control event from a separate class? rpardee@gmail.com Microsoft Access 1 15th May 2006 09:34 PM
Access a control's actual object from window handle question =?Utf-8?B?TWFyaw==?= Microsoft C# .NET 0 29th Jul 2004 12:51 AM
prevent a program to access the actual instance of application object =?Utf-8?B?VE5M?= Microsoft Access VBA Modules 5 2nd Mar 2004 06:07 PM
Reflection: CreateInstance(Type) of class that supports known interface - Get actual interface reference to object? Chris Morse Microsoft VB .NET 10 16th Jan 2004 01:30 AM
Sink managed (DataTable) event from unmanaged class? Bob Whiton Microsoft VC .NET 1 1st Sep 2003 02:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:02 PM.