Bulk deletion in Entities Framework 4

entity-framework

Question

If there is a suitable approach to mass delete or remove several rows using Entities Framework 4, please let me know. There doesn't seem to be a DeleteAll command. I want to remove a list of entities, however the only one that is accessible is DeleteObject(), which only accepts one item. Is there an alternative to iterating over the list? I did come across an article that prepared some sql and used ExecuteStoreQuery to carry out the deletion. Is there a more effective method than executing any of these two choices? Please advise on the most effective manner to carry out this task.

1
8
4/6/2010 10:53:19 PM

Accepted Answer

There isn't currently a classy method to do this. You'll need to loop through the list, you're right.

How do I remove many rows at once using Entity Framework? (without foreach) This SO post contains some interesting conversations on the subject.

3
5/23/2017 12:13:31 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow