Fetched Entity made into a new one then saved as an Insert?

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 11-Jul-2007 16:01:47   

Is there an easy way to take all the Entities in a Collection that was loaded from the DB, change their status to 'new'. Then when I call Save() on the collection, have them inserted as new records?

The PK is a composite key, so I would change one of the PK values before saving.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 11-Jul-2007 16:11:16   

Entities can be inserted rather than updated if their IsNew field is set to true. To accomplish this try any of the following: - Manually set each entity's IsNew field to true. - Projecting the EntityCollection.DefaultView to a new EntityCollection.