title: Entity Framework one-to-one relationship mapping flattened in code
body: <p>I have a table structure like so.</p>
  
  <pre><code>Address:
  AddressId int not null primary key identity
  ...more columns
  
  AddressContinental:
  AddressId int not null primary key identity foreign key to pk of Address
  County
  State
  
  AddressInternational:
  AddressId int not null primary key identity foreign key to pk of Address
  ProvinceRegion
  </code></pre>
  
  <p>I don't have control over schema, this is just the way it is.</p>
  
  <p>Now, what I want to do is have a single Address object.</p>
  
  <pre><code>public class Address
  {
      public int AddressId { get; set; }
      public County County { get; set; }
      public State State { get; set }
      public ProvinceRegion { get; set; }
  }
  </code></pre>
  
  <p>I want to have EF pull it out of the database as a single entity. When saving, I want to save the single entity and have EF know to split it into the three tables.</p>
  
  <p>How would I map this in EF 4.1 Code First?</p>
  
  <p>I've been searching around and haven't found anything that meets my case yet. </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>An address record will have a record in <code>Address</code> and one in either <code>AddressContinental</code> or <code>AddressInternational</code>, but not both.</p>