【发布时间】:2021-10-25 16:23:57
【问题描述】:
var results = context.Customer.Where(c => c.CustomerId == customerId).AsQueryable();
foreach(Customer cust in results)
{
cust.isDeleted = true;
}
context.UpdateRange(results);
context.SaveChanges();
** 使用循环似乎效率低下。获取和更新可以在一个语句中完成吗?
【问题讨论】:
-
这能回答你的问题吗? Bulk Update in Entity Framework Core
标签: c# .net entity-framework-core bulkupdate