linq to sql - How can I clone (or copy) a object to another one, but don't copy PK attribute? -
I'm trying to copy all object attributes to another object, FOX example:
person p1 = new person (); P1.name = "John"; P1.sex = 'M'; Person p2 = new person (); P2 = Utill. Clone (p1);
The problem is that the person unit has an identity PK 'codprison' and I do not want to copy this PK. Is there a way to clone / copy an object, but it does not have a copy of its PK attribute ??
Thank you!
- Make sure that Util.Clone (person p) codeproduction attribute
- Clear the attribute after the clone method
- Create a new person object, especially starting the special properties.
Comments
Post a Comment