Add/Delete from Collection

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 08-Jan-2008 19:57:03   

Newest Build, Self Servicing.

Is this still the best way to add entities and delete them from a collection, or has a new way come about?

Create a deleteCollection of type CustomerCollection

Loop thru the currentCustomersCollection Add the entity to delete to deleteCollection Remove the entity from currentCustomersCollection

Call currentCustomersCollection.SaveMulti() Call deleteCollection.DeleteMulti()

Thanks in advance Ian

goose avatar
goose
User
Posts: 392
Joined: 06-Aug-2007
# Posted on: 08-Jan-2008 21:57:30   

I think that is still the best way to do it. You could as well delete each entity directly to the database and refetch the entire collection afterwards if it feels somehow cumbersome to maintain 2 collections, but the later would be less performant.