title: How to map a Value Type which has a reference to an entity?
body: <p>I'm having a problem with a mapping in Entity Framework.</p>
  
  <p>I have the following classes (simplified):</p>
  
  <pre><code>public class Building
  {
  
      public int ID { get; set; }     
      // *.. snip..* other properties
      public Location Location { get; private set; }
  }
  
  public class Location
  {
      public string Street {get; set;}
      public Country country {get; set}
  }
  public class Country
  {
      public int ID { get; set; } 
      public string Name { get; set; } 
  }
  </code></pre>
  
  <p>Building and Country are entities, they are saved in the database. Location is a value type and should map to the same table as Building.</p>
  
  <p>However, when I map it this way, entity framework wants to map Location to a table as well and is complaining it has no Key. I don't want to give it a key since it belongs to the Building and should not be an entity at all.</p>
  
  <p>I have seen workarounds which say you need to put Country on the Building-class, but that just doesn't feel good (and is semantically just plain wrong). </p>
  
  <p>I'm using Entity Framework 5</p>