I have a EF4.1 class X and I want to make copy of that plus all its child records. X.Y and X.Y.Z
Now if I do the following it returns error.
The property \'X.ID\
I use Newtonsoft.Json, and this awesome function.
private static T CloneJson(T source) { return ReferenceEquals(source, null) ? default(T) : JsonConvert.DeserializeObject(JsonConvert.SerializeObject(source)); }