Say you have code like this .
using (CustomerContext db = new CustomerContext())
{
var foundCustList=db.Customers.Where(c=>c.State=='-1').ToList();//Find all the customer which State is -1
foreach(var c in foundCustList)
{
db.DeleteObject(c);
}
db.SaveChanges();//After all the customer is deleted, Commit.
}
But I want to know Is there any way to delete the list of object easily? I don't want to use the foreach
to do it one by one for a list . thanks.