I have some .NET remoting code where a factory method, implemented in some server side class, returns interfaces to concrete objects, also executing on the very same server. .NET remoting automagically creates proxies and allows me to pass the interfaces across to the client, which can then call them directly.
Example interfaces:
public interface IFactory
{
IFoo GetFoo();
}
public interface IFoo
{
void DoSomething();
}
Example client code:
...
IFactory factory = (IFactory) System.Activator.GetObject (typeof (IFactory), url);
...
IFoo foo = factory.GetFoo (); // the server returns an interface; we get a proxy to it
foo.DoSomething ();
...
This all works great. However, now I am trying to migrate my code to WCF. I wonder if there is a means to pass around interfaces and having WCF generate the proxies on the fly on the client, as does the original .NET remoting.
And I don't want to return class instances, since I don't want to expose real classes. And serializing the full instance and sending it back and forth between the server and the client is not an option either. I really just want the client to talk to the server object through an interface pointer/proxy.
Any ideas?