问题
I have a interface (let name it OuterInt) and a class (OuterClass) that implemented It. Interface OuterInt consists of the other intefaces (InnerInt1, InnerInt2 and etc.) And there are some classes (InnerClass1, InnerClass2 and etc.) that implement these inner interfaces. OuterClass is exposed by server-side of application by .NET remoting (RemotingServices.Marshal(_OuterClass, "myOuterInt");) My question is will inner classes be serialized in the process of remoting or not and should client-side of application knows about those classes (for example to have reference of assembly with these classes)? I hope that I described my question explicitly, if not - ask me in comments.
回答1:
Remoting (which is, as Oded notes, pretty much deprecated) creates a remote hook to the object; not the API (the interface). As such, it will indeed be necessary to have the same dll (containing the concrete type being remoted) at both ends. Whether it is serialized vs proxied depends on whether it inherits from MarshalByRefObject
. But typically: if it is in the object graph at one end, then it needs to be creatable at the other.
If possible, prefer virtually any other implementation to remoting, IMO.
来源:https://stackoverflow.com/questions/7553303/question-about-net-remoting-and-serializing