Ken Kolda
10/8/2004 7:49:00 PM
There is no built-in way to do this. You could create a singleton factory
with a method such as GetSharedObject() which returns an instance of the
shared class and, on every other call, creates a new instance. For example:
public class ObjectServer : MarshalByRefObject
{
SharedObject currentObject = null;
public SharedObject GetSharedObject()
{
lock (this)
{
if (this.currentObject == null)
{
this.currentObject = new SharedObject();
return this.currentObject;
}
else
{
SharedObject temp = this.currentObject;
this.currentObject = null;
return temp;
}
}
}
}
Ken
"Dieter De Preester" <dieter.de.preester@howest.be> wrote in message
news:uomQ1NRrEHA.3256@TK2MSFTNGP10.phx.gbl...
> Hello
>
>
> Is there a way to write a server activated object with singleton object
mode
> where only 2 client have a reference to the object. I am writing a
> application where a remote object may only be shared bij 2 clients.
> When a third clients comes in, he has to make a new instance of the
object.
>
> kind regards
>
> Dieter De Preester
>
>
>
>
>