Deleting multiple rows

Posts   
 
    
Posts: 2
Joined: 10-Mar-2006
# Posted on: 13-Mar-2006 15:06:58   

Can anyone recommend the best and most efficient way to delete multiple rows from a database table using LLBLGen? I was trying to use an entity collection, but thought that using a typed list would be more efficient. the following does not delete the entries like I had expected. Am I missing something?

LogListTypedList

Dim myLogList As LogListTypedList = New LogListTypedList Dim logRow as LogListRow

'delete For Each logRow In myLogList.Rows logRow.Delete() Next myLogList.AcceptChanges()

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 13-Mar-2006 15:15:21   

Removing items form Entity Collection or TypedLists, won't delete them from the database.

But you have 4 options to perform this task:

1- DeleteEntityCollection() / DeleteMulti() which deletes all entities inside an EntityCollection from the database.

2- Loop on the items and delete them One by One.

3- Add the items to be deleted to a UnitOfWork and commit them in one action.

4- Use the DeleteEntitiesDirectly method (available in the Adapter model only).