Delete all records with EDM
- by WooBoo
Yes, I need to clean a table and I have EDM that comes with .net 3.5 sp1 (I haven't tried with EF4).
I know that works:
foreach(var item in ctx.Elements){ ctx.DeleteObject(item); }
but it's not a point to get all data from the table and and deleting one by one. Ok, I know it's deleted when I run ctx.SaveChanges();
but DELETE FROM [Elements] looks better :)
Tried stored procedure and function import, but VS designer for EDM just doesn't work.
I also couldn't find any resources about defining it in .edmx manually.