How to Clone POCO entity and add to context
问题 I am using EF4 and I have create POCO objects with proxies from my database structure . I have a POCO (object) which has lots of relationships to other entities. I created a deep copy of the object using DataContractSerializer and BinaryFormatter and lets call it clonedObject. function used for cloning is: public T CloneProxy<T>(T source) { var dcs = new System.Runtime.Serialization .DataContractSerializer(typeof(T)); string filePath = "Initiative.txt"; using (FileStream file = new FileStream