title: How to set ID to correspondent to object in entity framework
body: <p>I have <code>Category</code> that can have <code>RootCategory</code>. Problem is that it does not set <code>RootCategoryID</code> properly, instead it is creating <code>Category_ID</code> in database that I don't even made in my model.</p>
  
  <p>It does map everything like I expect it to if I don't have modified <code>get</code> on RootCategory by the way. But then <code>RootCategory</code> is always null (he does not know where to get it from)</p>
  
  <p>Model</p>
  
  <pre><code>public class Category
  {
      public int ID { get; set; }
      // Tried [ForeignKey("RootCategoryID")]
      public Category RootCategory {
          get
          {
              ORDataContext _db = new ORDataContext();
              return _db.Categories.Where(x =&gt; x.ID == this.RootCategoryID).SingleOrDefault();
          }
      }
      public int? RootCategoryID { get; set; } // This does not set itself properly
  
      public ICollection&lt;Category&gt; ChildCategories { get; set; }
  }
  </code></pre>
  
  <p>Generated database after <code>update-database</code></p>
  
  <pre><code>-ID
  -RootCategoryID (that I have created, but it's not used)
  -Category_ID (taht EF created for me, that I don't want)
  </code></pre>