Delete all records with EDM

Posted by WooBoo on Stack Overflow See other posts from Stack Overflow or by WooBoo
Published on 2010-03-24T08:58:27Z Indexed on 2010/03/24 9:03 UTC
Read the original article Hit count: 509

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about edm

Related posts about sql