Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

update multiple records with entity framework

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();
}
 
PREVIOUS NEXT
Tagged: #update #multiple #records #entity #framework
ADD COMMENT
Topic
Name
2+1 =