title: Linq: How to create One-To-One relationship in program but with historical rows on database
body: <p>In the data model of my program I have a class (A) associated with another class (B). It's a one-to-one relationship. But in the database it's really a one-to-many relationship (because the B-table contains historical rows).</p>
  
  <p>For this question, let's just say that A is a patient and B is a admission to the hospital (my real domain takes a bit more explaining).</p>
  
  <p>My program is only interested in the latest admission of any patient (there may be no latest admission), but I want to keep the historical admission in my database so that I may pull reports of historical interest. </p>
  
  <p>In the database, the admission table has an fk_patient column (a foreign key). The patient table has no foreign key to the admission. There may be more than one admission for each patient.</p>
  
  <p>In my program, I want the Admission class and the Patient class to be associated with a one-to-one relationship in Linq.</p>
  
  <p>I have used the designer, creating this one-to-one relationship and it came up with an EnityRef. </p>
  
  <p>Question: How do I go about resolving my problem? I need my program to be unaware of the historical rows - but I still want them in my databaase. Is there any way to tell the EntityRef which row to pick, if it has multiple results? My solution is based on the linq designer and the auto-generated code it makes - but I do have the custom-made part of the partial classes</p>
  
  <p>I have been unable to google what happens if there is in fact more than one admission for a patient in this setup. Does it crash? Does it give me the first or the last (based on id, I presume) result? I need the last row (which would be the latest).</p>
  
  <p>I could make a separate historical table and move data from the real table to the historical table, but this is not what I want to do. I want an elegant and seamless solution with only one table.</p>
  
  <p>The database is SQL Server.</p>