WCF: Is there a way to 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-12T09:09:45Z Indexed on 2010/03/13 11:05 UTC
Read the original article Hit count: 125

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();

Is this possible? Or is my understanding wrong and this is not how it works in WCF? What would be a better design?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf