error: "Object graph for type 'TestLinq.PersonAddress' contains cycles and cannot be serialized if reference tracking is disabled.”
solution: change the 'Serialization Mode' to 'Unidirectional'.
source: http://stackoverflow.com/questions/1432501/clone-linq-object-error-object-graph-for-type-testlinq-personaddress-contains
cycle error on cloning linq object
Etiketler: linq , serialization
linq to sql - Make Entities Serializable (LINQ to SQL)
Etiketler: linq to sql , serialization
System.InvalidOperationException: A circular reference was detected while serializing an object of type
One of the important that things that you will likely have to do at one point or another with entity objects is serialize them. This could be for Web Services most commonly but could be for any sort of storage or transport scenario.
There are a number of pitfalls with this scenario however, primarily because LINQ to SQL will very likely generate circular references into your entity model from your data and XML Serialization will fail outright in that scenario. For example, say you have a customer and projects table and if you let LINQ generate the one to many relationship it will create Customer entity with a Projects property and a Project entity with a Customer property.
For code scenarios this is probably a good thing - you want to be able to see all Projects and filter that list in your code.
Unfortunately in a serialization scenario this doesn't work because you essentially have a circular reference - Customer ->Projects -> Customer. So we have a 1 -> Many and a 1 - 1 relationship going back to the original object here.
Etiketler: linq to sql , serialization