title: Setup One to Many without Foreign Key Entity Framework
body: <p>I have the following design.
  <a href="https://i.stack.imgur.com/bghEf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bghEf.png" alt="enter image description here"></a>
  As we can see from this image, an Episode will have multiple EpisodePatients, and each of these EpisodePatients, will point to one Episode.</p>
  
  <p>Here are my two models corresponding to the tables.</p>
  
  <pre><code>public class EpisodeModel
  {
      public int ID { get; set; }
      public virtual EpisodePatientModel EpisodePatient { get; set; }
  }
  public class EpisodePatientModel
  {
      public int EpisodePatientID { get; set; }
      public virtual EpisodeModel Episode { get; set; }
  }
  </code></pre>
  
  <p>How do I setup the One to Many relationship between <code>EpisodeModel</code> and <code>EpisodePatientModel</code>?</p>
  
  <p>Since <code>EpisodeModel</code> does not contain a foreign key to EpisodePatient, I cannot do the following.</p>
  
  <pre><code>modelBuilder.Entity&lt;EpisodeModel&gt;().HasRequired(r =&gt; r.EpisodePatient).WithMany().HasForeignKey() //No foreign key
  </code></pre>
  
  <p>I have tried this.</p>
  
  <pre><code>modelBuilder.Entity&lt;EpisodeModel&gt;().HasRequired(r =&gt; r.EpisodePatient);
  </code></pre>
  
  <p>But with this approach, the EpisodeModel is not Lazy loaded when loading all EpisodePatientModels form the DB</p>