0

有没有办法使用实体框架根据谓词规则从数据库中删除一组行?

只是一个不起作用的例子:

context.entity.remove(i => i.name == "name");

我今天的做法并不简单。我将不得不逐项循环和删除。

4

1 回答 1

2

您可以使用 EntityFramework.Extended 库。 https://github.com/loresoft/EntityFramework.Extended

例子:

//delete all users where FirstName matches
context.Users.Delete(u => u.FirstName == "firstname");

这种方法不会从数据库中检索行。

于 2013-01-29T04:05:42.800 回答