📜  使用实体框架更新多条记录 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:15.660000             🧑  作者: Mango

代码示例1
using (var dbcontext = new MyModel()){
   var matchedRecords = dbcontext.DummyTable.Where(e => e.code.Equals(entry.code) && e.isValid.Equals(true)).ToList();
   matchedRecords.ForEach(e => e.isValid = false);
   dbcontext.SaveChanges();
}