删除LINQ查询中的多个记录的最佳方法? [英] Best way to delete multiple records in a LINQ query?
本文介绍了删除LINQ查询中的多个记录的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用LINQ一次删除多个记录的最佳方法是什么?
What is the best way to remove multiple records in one go with LINQ?
推荐答案
使用Linq2Sql删除记录
To delete records with Linq2Sql
CustomerDataContext ctx = new CustomerDataContext("connection string");
var customers = ctx.Customers.Where(c => c.Name == "david");
ctx.Customers.DeleteAllOnSubmit(customers);
ctx.SubmitChanges();
这篇关于删除LINQ查询中的多个记录的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文