实体框架中的批量删除 [英] bulk delete in entity framework

查看:70
本文介绍了实体框架中的批量删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用linq从表中批量删除记录. 有一篇文章介绍了如何执行此操作: 批量删除LINQ中的实体

I'd like to bulk delete records from a table using linq. There's a post that describes how to do it: Bulk-deleting in LINQ to Entities

var query = from c in ctx.Customers
            where c.SalesPerson.Email == "..."
            select c;

query.Delete();

但是我的var变量中不存在删除"功能.
此外,我的上下文中不存在"SubmitChanges"功能.

But the function "Delete" doesn't exist in my var variable.
Furthermore, the function "SubmitChanges" doesn't exist on my context.

推荐答案

有一个有趣的NuGet软件包,它

There is an interesting NuGet package that lets you do batch deletes and updates:

这篇关于实体框架中的批量删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆