views:

41

answers:

1

Anyone know why only undirectional serialization is supported in the Linq designer?

Consider the following example:

Say we have a Customer who requested an Order containing Products. We set the Serialization Mode in the Linq designer to Unidirectional to enable serialization.

When looking at the code for the Order object, the DataMember attribute is added to all its internal properties such as ID,OrderNumber, etc. and also to the EntitySet of Products, but not to Customer.

One can get around this by manually adding the DataMember attribute to Customer, but this becomes quite cumbersome when there's loads of entities in the database.

+1  A: 

A partial explanation and workaround is given here. Basically, the cyclic dependencies can occur if the serializer isn't sophisticated. A workaround for bidirectional serialization is available for VS 2008 is given for .NET 3.5 SP1.

Andy