WCF: Is there a way to return an object that can be executed on the server?

Based on the Java background, I think so:

The server provides the object to the client. This object must be executed 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(); }

Customer:

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

Is it possible? Or is my understanding wrong, and that's not how it works in WCF? What would be better?

+1
source share
2 answers

No, I don’t think it will work. You see: WCF is not some kind of remote remote, remote object or remote procedure mechanism.

WCF . ; WCF , ( ) ( , ). , , , .

. , , - XML . .. - , ..

+3

- . marc_s, WCF , .

.

Windows Communication Foundation : , CLR (Common Language runtime) (CLR), . . Beans J2EE.

, - Sessionful Session Beans J2EE. , , , WCF . , -, .

ServiceContract.

Juval Lowy WCF.

-, .

0

Source: https://habr.com/ru/post/1736844/


All Articles