title: EF Attach won't update database fields to null
body: <p>I'm facing a problem that when I set a field any value than empty, EF will update the database.</p>
  
  <p>But, when I clear the field (input[text] empty), the matching field in DB won't update to NULL.</p>
  
  <p>Here are the codes:</p>
  
  <p>C#</p>
  
  <pre><code>var entidade = new Plantas { CodPlanta = vm.CodPlanta };
  db.Plantas.Attach(entidade);
  
  entidade.CodEstado = vm.CodEstado;
  entidade.NomePlanta = vm.NomePlanta;
  entidade.CEP = vm.CEP;
  entidade.Telefone = vm.Telefone;
  entidade.Fax = vm.Fax;
  
  db.SaveChanges();
  </code></pre>
  
  <p>SQL generated by EF</p>
  
  <pre><code>exec sp_executesql N'update [dbo].[Plantas]
  set [CodEstado] = @0, [NomePlanta] = @1, [CEP] = @3
  where ([CodPlanta] = @4)
  ',N'@0 int,@1 varchar(200),@3 char(8),@4 int',
  @0=26,
  @1='Apiaí',
  @2='Integrada',
  @3='18320000',
  @4=373
  go
  </code></pre>
  
  <p>See that when <code>vm.Telefone</code> and <code>vm.Fax</code>, these fields won't show in UPDATE query. But if a put some value, they will.</p>
  
  <p>Even if the fields have some value before.</p>
  
  <p>If a put a breakpoint at <code>db.Savechanges()</code>, it will show <code>entidade.Telefone = null</code>. But it won't go to the generated query.</p>
  
  <p>How can I force Entity Framework to set fields to null?</p>