In one of our project we’re using Linq-to-SQL to get data from our database. There are a lot of tables that have references to others. We’re using the LoadWith method to get a hold of that data. The data is than serialized and send to a client application using WCF. On the cliend the references are gone. When stepping thru the code and watching what happens, you can see the data is available on the server, but is gone on the client.
In case of custom classes you can add attributes to make this work, but with Linq-to-SQL all code is generated.
Is there any way to serialize/deserialize this data?
I’ve decided to create a new class that only contains the fields I would like to communicate to the client, instead of returning everything using a couple of LoadWiths. This reduces traffic a lot, because the objects that have to be serialized are much smaller and I do not run into this problem again.