可能重复删除从表中的多个行:
EF Code First Delete Batch From IQueryable<T>?与LINQ查询
如何从表中删除多行与LINQ查询。
我有这样的代码:
var subjects = (from sub in db.Subjects select sub)
.Where(sub => sub.title.StartsWith("ab"));
,我想删除我的表中的所有这些问题在一个命令就像在SQL:
"Delete FROM table WHERE ..."
这是LINQ-to-SQL,LINQ-to-Entities ...其他吗?没有内置的方法来做到这一点,但有扩展方法可以做到这一点(但可能有一些不需要的副作用)。 – Ocelot20 2012-07-14 18:08:14
其LINQ to Entities – Hasan 2012-07-14 18:14:39
我刚才问了一个类似的问题,并在这里得到了一个明智的答案:http://stackoverflow.com/questions/8538899/ef-code-first-delete-batch-from-iquibeablet – Ocelot20 2012-07-14 18:17:17