Hello, I'm trying to make a copy of a BO using the method that Rocky talked about in another post. My object graft looks something like this. I'm using CSLA 4.3.
parent
single child
single child
child list
child list
single child
child list
child list
I have a static method on the parent object that accepts the "copy from" Id.
Object from = GetObject(id);
Object newObject = from.Clone();
newObject.MarkNew()
newObject.Id = Guid.NewGuid();
newObject.Child.FixUpAfterCopy();
...
So the single child objects are cloning correctly but the child list objects of the single child objects are not cloning all the time. If I but a break point in the "FixUpAfterCopy()" of the child then it copies. Could it be the lazy loading of the child list? Any other suggestions?
Thanks,
J
If you are lazy loading lists I'd say yes that could be why some of them aren't cloning; cloning I don't believe causes lazy loaded lists to load if they are not already loaded, rather you get a copy of the graph exactly as it is when you call Clone.
Copyright (c) Marimer LLC