views:

76

answers:

2

Hi I want to delete multiple records in enitity framework without using a for loop or any other loop using LINQ. Something that we can do it in SQL is there any way to delete multiple records in enitity framework

+4  A: 

What you want to do is not supported using Entity Framework. Entity Framework needs to load an object into memory, before you can delete it. This way it can do its optimistic concurrency checks.

If you really need this, you will have to do this with pure SQL or better, use a stored procedure. You can call your stored procedure with Entity Framework.

Steven
+1  A: 

This link may help you: Bulk Delete with EF4

mdm20