What is the best way to remove multiple records in one go with LINQ?
Removing many records based on single where clause
context.EntityModel
.RemoveAll(r => r.property == "propertyEntered");
But you could also Remove records from the database that don't exist in List
context.EntityModel
.Where(w => w.propertyID == ID).ToList()
.RemoveAll(r => !ListOfBadRecords.Any(a => a.anyID == r.propertyID ));
Edit:
Unsure wich is quicker but you could do the 2nd query with this also
.RemoveAll(r => !ListOfBadRecords.Select(s=>s.propertyID ).Contains(w.propertyID ))
Edit2: don't forget context.SaveChanges();
as i did in the first draft