I have a Client Model and need to update on EnviadoEmailCobranca para 0
I'm doing this:
var clientes = db.Clientes.Where(w => w.Status == 4);
foreach (var item in clientes)
{
item.EnviadoEmailCobranca = false;
db.Entry(item).State = EntityState.Modified;
db.SaveChanges();
}
But this is kind of donkey , since I'm doing 2mil updates separately. There is something like:
Update tabela_Clientes where EnviadoEmailCobranca=0 where Status =4
I did not want to do this:
var SQL = "Update tabela_Clientes where EnviadoEmailCobranca=0 where Status =4";
dbMailEnable.Database.ExecuteSqlCommand(SQL);