title: Entity framework map entity to multiple tables?
body: <p>I'm facing a problem using EF. I have the following situation:</p>
  
  <blockquote>
    <p>Table User: Username, Password, RoleId, IsActive, CreatedDate, ActivedDate</p>
    
    <p>Table Admin: Username, Name</p>
    
    <p>Table Staff: Username, Name, Position, Phone</p>
  </blockquote>
  
  <p>From this database schema i'd like to generate the following entity by merge tables data:</p>
  
  <pre><code>public class User
  {
      [Key]
      public string Username { get; set; }
      public string Password { get; set; }
      public int RoleId { get; set; }
      public bool IsActive { get; set; }
      public DateTime CreatedDate { get; set; }
      public DateTime ActivedDate { get; set; }
  
      public string Name { get; set; }
      public string Phone { get; set; }
      public string Position { get; set; }
  
      [ForeignKey("RoleId")]
      public Role Role { get; set; }
  }
  </code></pre>
  
  <p>configuration class:</p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;User&gt;()
              .Map(map =&gt;
              {
                  map.Properties(p =&gt; new
                  {
                      p.Username,
                      p.Password,
                      p.RoleId,
                      p.IsActive,
                      p.CreatedDate,
                      p.ActivedDate
                  });
                  map.ToTable("User");
              })
              .Map(map =&gt;
              {
                  map.Properties(p =&gt; new
                  {
                      p.Username,
                      p.Name
                  });
                  map.ToTable("Admin");
              }).Map(map =&gt;
              {
                  map.Properties(p =&gt; new
                  {
                      p.Username,
                      p.Name,
                      p.Phone,
                      p.Position
                  });
                  map.ToTable("Staff");
              });
  
          base.OnModelCreating(modelBuilder);
      }
  </code></pre>
  
  <p>I've tested it but it doesn't work as expected. I always get this message:</p>
  
  <blockquote>
    <p>Properties for type 'User' can only be mapped once. The non-key property 'Name' is mapped more than once. Ensure the Properties method specifies each non-key property only once.</p>
  </blockquote>
  
  <p>Am I missing something?</p>