I’ve got a class which has properties referenced to couple of interfaces and classes.
Now I’m trying to transfer this one class via WCF (named pipes), what’s the best way to deal with it?
Shall go into all referenced interfaces, class and mark stuff as <DataContract()>, <Serializable()> and <DataMember()>, which means at least 6-10 classes to change.
Is there any other practical way to solve this problem? These interfaces and classes all shared in the host as well as the client. They are using the very same DLLs.
Don’t use this complicated type – create a new data contract type that has no dependencies and send that over the wire. Then create an operation contract that accepts this data contract and maps the data contract to your existing type. Since you are sharing assemblies you could make sure that the logic for mapping from the data contract to the complicated type is in the shared assemblies so that both sides of the wire have access to it.
As a side note: are you sure that this is the best way to do this? WCF works best when services are decoupled from each other and it sounds like your services know too much about each other.