New Posts New Posts RSS Feed: Handling multiple deletes
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Handling multiple deletes

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: Handling multiple deletes
    Posted: 03-Feb-2009 at 9:04am
I need to retrieve an entityList from a table and then delete all the entities in that list.  What's the best way to handle this? Should I retrieve the entityList and then loop through the list deleting each entity or is there a better way to do it?
 
Bill
 
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 04-Feb-2009 at 1:49pm
In most cases, it probably doesn't make a very big difference how you do it, but if you had a very big list,  you will get bettter performance if you can delete them as a group.  In particular,  mark all pf your deleted items, and then do a sisngle SaveChanges.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down