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

Remoting is deprecated (everyone continues to point to WCF), and WCF does not support this at all ( WCF: is there any way to return an object that the server can execute? ), So how should I implement this behavior? Use of third-party components is possible if required.

I searched for SO but did not find a similar question. If this has already been answered, just let me know and I will delete.

+3
source share
3 answers

I recommend not trying to "remote" objects. This is a dangerous idea.

  • . .
  • , "" , .
  • , , , "" , .. , .
  • .
  • , , , , ..

, . . . , .

+4

WCF , Remoting .... : ?

+3

, WCF - , , , () - , NetDataContractSerializer. .

- , - , , .

I have to add that with a proper design, you still get a contract / message based app, even with .Net Remoting. Your common interfaces will become contracts of operations, while the definitions of shared data classes will describe the data / messages you are transmitting.

+2
source

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


All Articles