473,661 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

access an actual object of ContextboundObj ect in sink class?


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

The property created for the context implements IContributeObje ctSink
(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 MarshalByRefObj ect's TransparentProx y
instead of the actual object represented by the transparentProx y.

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.

Jun 18 '06 #1
1 1759
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 MarshalByRefObj ect is
passed because it is the subtype that all ContextBoundObj ects have to derive
from.

Hope his helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"pinetaj" <ok****@gmail.c om> wrote in message
news:11******** *************@f 6g2000cwb.googl egroups.com...

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

The property created for the context implements IContributeObje ctSink
(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 MarshalByRefObj ect's TransparentProx y
instead of the actual object represented by the transparentProx y.

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.

Jun 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3557
by: Dejun Yang | last post by:
Could anybody help me? How to sink an event from C++.NET in C#? For example, for following CSource, how to sink EventTest in C#? #pragma once #include <windows.h> using namespace System; namespace CSource {
1
1771
by: Robert Zurer | last post by:
My architecture is, (ala Fowler PoEAA) Presentation Layer | Service Layer | Problem Domain (My Business Objects are held in memory) | Persistence Layer
49
3183
by: Relaxin | last post by:
It is just me or has MS created some of the worst ways to access and display data? You can use a DataSet, but if you want to sort or filter the data to must use a DataView which is created from a DataSet. But, if you sort by using the Grid (clicking the header) you can no longer use the DataSet (or maybe the DataView, if that is what you are using) to locate the record that the user has selected!!
7
2071
by: James Fortune | last post by:
In response to different users or situations (data context) I transform the appearance and characteristics of Access Forms through code. This seems to fit in with the idea of polymorphism. Do people consider Access Forms to be Polymorphic? James A. Fortune
0
1836
by: techie | last post by:
I have created an event sink in my ATL COM project. The event sink receives events from a C# component. There is no problem with receiving events but when my COM object is released I get an access violation - (MSCORWKS.DLL): 0xC0000005: Access Violation. At first I thought it could be due to my C++ code but after quite a lot of investigation I don't think there is nothing wrong with it. The access violation occurs after the destructor...
0
1392
by: techie | last post by:
I have created an event sink in my ATL COM project. The event sink receives events from a C# component. There is no problem with receving events but when my COM object is released I get an access violation - (MSCORWKS.DLL): 0xC0000005: Access Violation. Here's my event sink class: namespace { static const int EVENT_ID = 111;//any arbitary value
6
1802
by: moondaddy | last post by:
I'm new to c# and am wondering if its possible to access members of a nested class. Can someone please advise? Thanks. class Program { static void Main(string args) { try { Test1 obj = new Test1();
1
3723
by: lactaseman | last post by:
While I know this is not the correct venue... I realize this is of little to no importance to most out there... however, if I had found this in my initial searches, I would have used this. So, as an alternative to the mentalis.org's IniReader, I submit the following files to the web news group DBs...: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
7
2289
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using FindControl the only way to do it?
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8758
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7364
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.