Groups | Blog | Home
all groups > dotnet remoting > december 2005 >

dotnet remoting : Is object remote activated



defense
12/14/2005 1:02:23 AM
I have .net class library, which classes I activate as client objects
and/or as remote objects. Inside those objects I need to know how were
they activated: remote or inside client application. Question: how to
get that information from object?
Chris Yager
12/14/2005 7:14:06 AM
You can check the RemotingConfiguration.IsTransparentProxy() passing the
possible remote reference. This returns a boolean indicating if the object
is a transparentproxy object. If it is not then it is a local object. For
example:
// Creates an instance of a context-bound type SampleSynchronized.
SampleSyncronized sampSyncObj = new SampleSyncronized();

// Checks whether the object is a proxy, since it is context-bound.
if (RemotingServices.IsTransparentProxy(sampSyncObj))
Console.WriteLine("sampSyncObj is a proxy.");
else
Console.WriteLine("sampSyncObj is NOT a proxy.");


-chris

[quoted text, click to view]

AddThis Social Bookmark Button