SingleCall calling SingleTon object
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.

Post a new message to this list...

Lord2702
Mon. Sep. 13, 2004 1:20 PM PT

Suppose, I have a server, which hosts two MBRO's, one is SingleCall
(MBRO_One) and another is SingleTon (MBRO_Two). Both hosts on one server,
Now, client will call a function from MBRO_One, which further calls a
function in MBRO_Two. Is it possible to place this call. If possible, then
how do I activate the MBRO_Two object, on MBRO_One object side. Because Both
these objects are on one AppDomain, whereas Client is on separate domain.

Thanks.

Reply to this message...
 
    
Ken Kolda
Assuming it's your single-call object accessing your singleton, you can do
this two ways:

1) Marshal your singleton manually instead of using the
RemotingConfiguration.RegisterWellKnownServerObject(). This will allow you
to create a static instance of your remoted class which is accessible both
by remote objects and objects in the same AppDomain. For example:

class MySingletonObject : MarshalByRefObject
{
public static MySingletonObject RemotedObject = new MySingletonObject();
}

class MyServer
{
public static void Main()
{
// Marshal object manually
RemotingServices.Marshal(MySingletoneObject.RemotedObject,
"Singleton.rem");
}
}

class MySingleCallObject : MarshalbyRefObject
{
public void SomMethod()
{
MySingletonObject.RemotedObject.SomeOtherMethod();
}
}

2) You can actually make your server a client of itself. In your SingleCall
object's methods, you would use Activator.GetObject() to fetch a reference
to the Singleton. This will be slower because you're actually going out thru
remoting and back in with each method call, but it requires less work. Plus,
if the object you're calling is SingleCall instead of Singleton, this is the
only way to do it (beside various techniques of wrapping the single-call
object).

Hope that helps -
Ken

"Lord2702" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Lord2702
Yes that helps a lot, I actually thought of making SingleTon MBRO as
Singleton, but then stop, at the point that hey, as already this object is A
Singleton, but then in your design, it makes me simple to access the static
instance of SingleTon object. Thanks.

"Ken Kolda" <Click here to reveal e-mail address> wrote in message
news:%23%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Activator
System.AppDomain
System.MarshalByRefObject
System.Runtime.Remoting.RemotingConfiguration
System.Runtime.Remoting.RemotingServices




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com