Discussion:
Remoting interfaces only
(too old to reply)
Arkej
2008-07-23 14:12:41 UTC
Permalink
Hello again with another question,

I want to publish a factory interface on the server side and i do it using
RemotingServices.Marshal. On the client side I use
RemotingServices.Connect(typeof(IFactory), "url of published object") and i
get an IFactory proxy. Until here everything ok, I do have an interface to
the factory object on the server needing no implementation assemblies of the
server. Now if IFactory is as follows:
public interface IFactory
{
IBlaBlaManager GetManager( string managerId);
}
and I call on the client ifactory.GetManager("tubo") I want it to give me an
IBlaBlaManager interface to the remote object on the server implementing the
IBlaBlaManager. But if on the server the implementation of the IFactory is
as follows:
IBlaBlaManager IFactory.GetManager( string managerId)
{
return (IBlaBlaManager)(new BlaManager());
}
and BlaManager does implement IBlaBlaManager. It won't work because it
remotes(serialize) the BlaManager object which is not known on the client.
Is there a way to get only the interface of the BlaManager object rather
than publishing the BlaManager and accessing it form the client in the same
way as the factory is accessed?

Thx
Robert
Arkej
2008-07-23 14:41:39 UTC
Permalink
I've found the solution:
The BlaManager class must inherit form MarshalByRefObject and it works as
wanted.
Post by Arkej
Hello again with another question,
I want to publish a factory interface on the server side and i do it using
RemotingServices.Marshal. On the client side I use
RemotingServices.Connect(typeof(IFactory), "url of published object") and
i get an IFactory proxy. Until here everything ok, I do have an interface
to the factory object on the server needing no implementation assemblies
public interface IFactory
{
IBlaBlaManager GetManager( string managerId);
}
and I call on the client ifactory.GetManager("tubo") I want it to give me
an IBlaBlaManager interface to the remote object on the server
implementing the IBlaBlaManager. But if on the server the implementation
IBlaBlaManager IFactory.GetManager( string managerId)
{
return (IBlaBlaManager)(new BlaManager());
}
and BlaManager does implement IBlaBlaManager. It won't work because it
remotes(serialize) the BlaManager object which is not known on the client.
Is there a way to get only the interface of the BlaManager object rather
than publishing the BlaManager and accessing it form the client in the
same way as the factory is accessed?
Thx
Robert
Loading...