EF Relationship (1 to 0..1) won't be removed
<p>I have a Code First model in Entity Framework version 6.1.1 that basically looks like this:</p>

<pre><code>public class TinMan {
    public int Id { get; set; }
    public virtual Heart Heart { get; set; }
}

public class Heart {
    public int Id { get; set; }
}
</code></pre>

<p>This is represented in an actual database like this, where the <code>Heart_Id</code> column is generated automatically by EF which also creates the foreign key relationship between the two tables:</p>

<pre><code>TinMen:                 Hearts:

Id    Heart_Id          Id
1     1                 1
2     3                 2
3     NULL              3
</code></pre>

<p>Creating a relation where none exist, or changing an existing relation works just fine:</p>

<pre><code>using (MyDbContext dbContext = new MyDbContext()) {
    TinMan bill = dbContext.TinMen.FirstOrDefault(man =&gt; man.Id == 1);
    if (bill != null) bill.Heart = 2;
    TinMan bob = dbContext.TinMen.FirstOrDefault(man =&gt; man.Id == 3);
    if (bob != null) bob.Heart = 1;
    dbContext.SaveChanges();
}
</code></pre>

<p>Now I try to remove a relation:</p>

<pre><code>using (MyDbContext dbContext = new MyDbContext()) {
    TinMan jebediah = dbContext.TinMen.FirstOrDefault(man =&gt; man.Id == 2);
    if (jebediah != null) jebediah.Heart = null;
    dbContext.SaveChanges();
}
</code></pre>

<p>After this has been executed TinMan with ID==2 <em>still</em> has a Heart in the database, i.e. it was <strong>not</strong> set to <code>NULL</code> in the database.</p>

<p>Why?</p>