I have a WCF service that can return several different collections.
Objects in each collection may have links to objects in other collections. For instance. I have a collection of orders and a collection of customers. Customer objects contain a set of links to an order, and each order contains a customer link.
I was wondering how people usually deal with such things on the client side. As far as I can tell, my options are:
1) Just let WCF serialize any member objects in full and not worry about duplication. I know that I can use [PreserveReferences] to mitigate this to some extent, but there is still a lot of duplication and unnecessary serialization. That is, if I request a client object from a service, it will serialize all the members of each order that the client has, even if I already have these objects on the client side in my order collection. It also means that I have to be careful to match things by id all the time, and not just compare instances.
2) Serialization identifier, not instances. This seems like the most sensible approach, but means that I should have some time when I return that identifier to instances on the client side again. This leads to confusion about where to do this and how to enter the necessary repositories for posting.
3) Just use Id everywhere in the client, and not connect instances. This is simply wrong for me and moves away from the whole OOP point. Instead of accessing the collection on the object, I have to access the collection of identifier and then view them through some global repository.
Right now I'm leaning towards 2, but I don't like serialization.
I should note that the client is probably much more resilient to the state than most WCF clients, and supports an open connection to the service with callbacks, etc. to support his collections as he displays real-time data.
Greetings
source share