> 2- Semantics: A well-behaved implementation of Clone would be expected
> to recursively call Clone on any ICloneable objects it contains. This
> does not happen when you do binary serialization, which can be an
> issue.

There's also a third semantic issue which can be a problem depending
on your particular use case. If your doing this to clone an entity
object which is de/rehydrated from a database and contains a primary
key value (e.g. an public int Id {get; set;} or similar) then your
"cloned" object (and it's collections of objecs) will likely cause
problems for whatever infrastructure you use to persist this to the
database. (e.g. attempting to save two different objects with the same
PK). This is solvable - but needs to be carefully considered -
especially when child collections of entities are taken into account.
(e.g. Order -> OrderLine -> Product ).

HTH,

j.

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to