title: Is it necessary to NULL the EntityReference properties before saving changes in EntityFramework?
body: <p>First of all I am not an expert on Entity Framework.</p>
  
  <p>And I have seen some piece of code in one project's Repositories, which </p>
  
  <ul>
  <li>NULLs the EntityReference properties on the entity </li>
  <li>And keeps that EntityReference's ID </li>
  </ul>
  
  <p>before Saving changes of this entity.</p>
  
  <p>For example it does this setting before saving Foo entity:</p>
  
  <pre><code>if (foo.Bar !=null)
  {
    foo.BarID = foo.Bar.ID;
    foo.Bar = null;
  }
  </code></pre>
  
  <p>Can this be an EntityFramework related requirement to null the EntityReference properties but using their IDs only in order to Save ?</p>