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
Gönderen
pantepember
24 Ocak 2011 Pazartesi
Etiketler: linq , serialization
clone linq object
Gönderen
pantepember
///
/// Clones any object and returns the new cloned object.
///
///
///
The original object.///
public static T Clone
{
var dcs = new DataContractSerializer(typeof(T));
using (var ms = new System.IO.MemoryStream())
{
dcs.WriteObject(ms, source);
ms.Seek(0, System.IO.SeekOrigin.Begin);
return (T)dcs.ReadObject(ms);
}
}
source:http://stackoverflow.com/questions/2178080/linq-to-sql-copy-original-entity-to-new-one-and-save
Etiketler: DataContractSerializer , linq