Sunny
7/21/2004 2:38:00 PM
You can not bypass the configuration. After all with the config you tell
exactly that: "I want this object to be remote".
But still, I'll go with a (double) factory pattern :)
Lets say at server I have a factory, which returns a remote reference to
the CAO I need.
And on the client I can configure the remoting only for that factory. So
the administrator still can configure where from you get your remote
objects.
And on the client I will implement some helper method like:
MyRemObj CreateObject(bool local)
{
MyRemObj ret = null;
if (local)
ret = new MyRemObj();//create a local copy
else
ret = myRemoteFactory.CreateObject();
return ret;
}
Still not convinced?
Sunny
In article <O4Vf0a$ZEHA.2792@TK2MSFTNGP09.phx.gbl>,
microsoft@anywhere.com says...
> thanks for your reply daniel - however your answer has not actually
> targetted the problem. the problem is:
>
> administrator configures MyClass to be hosted on a different machine - this
> is great - its what i want - for those classes of mine that that don't care
> where the instance is created
>
> however
>
> i have some local classes which also use instances of MyClass- but they need
> MyClass instances to be created in my appdomain, in my context.
>
> - it is here that the problem lays - how can i have remoted configured BUT
> also ensure i can create local instances as i see fit.
>
> cheers
>
> jason
>
>
> "DanClayden" <DanClayden@discussions.microsoft.com> wrote in message
> news:EEF8496D-8651-499A-9490-C713831ACACE@microsoft.com...
> > Have you tried using RemotingServices.Marshal ? We create an object using
> new, as usual, then call RemotingServices.Marshal() to get an ObjRef.
> >
> > You can then call RemotingServices.Unmarshal on the ObjRef to get a proxy,
> or get the URI from the ObjRef and then call RemotingServices.Connect() to
> connect to it from another machine.
> >
> > Daniel
>
>
>