How do I return an object that is able to execute on the server?

Posted by mafutrct on Stack Overflow See other posts from Stack Overflow or by mafutrct
Published on 2010-03-13T23:55:02Z Indexed on 2010/03/14 0:05 UTC
Read the original article Hit count: 119

Filed under:
|

Coming from a Java background, this is the way I'm thinking:

The server provides an object to the client. This object should be able to execute on the server.

Server:

private string _S = "A";

public interface IFoo { void Bar(); }

private class Foo : IFoo {
    void Bar() { _S = "B";}
}

public IFoo GetFoo() { return new Foo(); }

Client:

IFoo foo = serverChannel.GetFoo();
foo.Bar();

Remoting is legacy (everyone keeps pointing to WCF instead) and WCF does not support this at all basically ( http://stackoverflow.com/questions/2431510 ), so how should I implement this kind of behavior? Using 3rd party components is possible iff required.

I searched on SO but found no similar question. If this has indeed been answered before, just let me know and I'll delete.

© Stack Overflow or respective owner

Related posts about c#

Related posts about remoting