Print Page | Close Window

Handling multiple deletes

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1078
Printed Date: 19-Apr-2025 at 8:39am


Topic: Handling multiple deletes
Posted By: BillG
Subject: Handling multiple deletes
Date 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
 



Replies:
Posted By: davidklitzke
Date 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.



Print Page | Close Window