title: Entity Framework set navigation property to null
body: <p>I have a entity framework database first project. here is a extraction of the model:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public partial class LedProject
  {
      public LedProject()
      {
          this.References = new HashSet&lt;LedProjectReference&gt;();
          this.Results = new HashSet&lt;LedProjectResult&gt;();
          this.History = new HashSet&lt;LedProjectHistory&gt;();
      }
  
      public string Identifier { get; set; }
      public string Name { get; set; }
      public Nullable&lt;System.DateTime&gt; CompletionDate { get; set; }
      public System.DateTime CreationDate { get; set; }
      public System.Guid ProjectId { get; set; }
      public string Comment { get; set; }
  
      public virtual User ContactUser { get; set; }
      public virtual User CreationUser { get; set; }
      public virtual Customer Customer { get; set; }
      public virtual LedProjectAccounting Accounting { get; set; }
      public virtual LedProjectState State { get; set; }
      public virtual ICollection&lt;LedProjectReference&gt; References { get; set; }
      public virtual ICollection&lt;LedProjectResult&gt; Results { get; set; }
      public virtual User ResponsibleUser { get; set; }
      public virtual ICollection&lt;LedProjectHistory&gt; History { get; set; }
  }
  </code></pre>
  
  <pre class="lang-cs prettyprint-override"><code>public partial class User
  {
      public System.Guid UserId { get; set; }
      public string LoginName { get; set; }
      public System.DateTime CreationDate { get; set; }
      public string Firstname { get; set; }
      public string Lastname { get; set; }
      public string Email { get; set; }
  }
  </code></pre>
  
  <p>I have a problem with setting the navigation item <code>ResponsibleUser</code> of the class <code>LedProject</code>. When I set the <code>ResponsibleUser</code> to a another user and afterwards save the changes of the DBContext, the changes are stored in the database.</p>
  
  <p>But, when I want to delete the current <code>ResponsibleUser</code> of an <code>LedProject</code>, by setting the navigation property to null. The changes are not stored in the database.</p>
  
  <pre class="lang-cs prettyprint-override"><code>LedProject project = db.LedProject.Find(projectId);
  project.Name = string.IsNullOrEmpty(name) ? null : name;
  ...
  project.ResponsibleUser = responsibleUser == null ? null : db.User.Find(responsibleUser.UserId);
  ...
  db.SaveChanges();
  </code></pre>
  
  <p>Is there any trick for deleting navigation properties?</p>