title: error 0019: Each property name in a type must be unique on ID field
body: <p><strong>ANSWERED!</strong> (will be posting it shortly.  I seriously think it's a bug in EF.)</p>
  
  <p>I have the following set of (code-first) classes which will be the future of the application as we are replacing the old (gen'd from db).  The dbcontext, two mappings/configurations, two POCOs, and a base class.</p>
  
  <p>In addition to this in another project entirely is an edmx generated from the database.  Up until now, there have not been any issues with the two conflicting. There are several other unrelated sets in the context (not shown,) but it wasn't until I started trying to get the relationship between <code>SalesReps</code> and <code>SalesGroups</code> that I started having issues.  Commenting out adding the <code>SalesGroupMapping</code> in <code>OnModelCreating</code> will allow it to run.</p>
  
  <p><strong>The Error</strong>:</p>
  
  <pre><code>Schema specified is not valid. Errors:
  (19,6) : error 0019: Each property name in a type must be unique. Property name 'PKID_MasterRepGroup' was already defined.
  (27,6) : error 0019: Each property name in a type must be unique. Property name 'PKID_MasterRepGroup' was already defined.
  </code></pre>
  
  <p><strong>The Code:</strong></p>
  
  <pre><code>public class MyDbContext{
  public IDbSet&lt;SalesGroup&gt; SalesGroups { get; set; }
  
  
              public IDbSet&lt;SalesRep&gt; SalesReps { get; set; }
              protected override void OnModelCreating(DbModelBuilder modelBuilder)
                          {
                              modelBuilder.Configurations.Add(new InsuranceProviderMapping());
                              modelBuilder.Configurations.Add(new SalesGroupMapping());
                              modelBuilder.Configurations.Add(new SalesRepMapping());
                              base.OnModelCreating(modelBuilder);
  
                          }
  }
  
          class SalesRepMapping : EntityTypeConfiguration&lt;SalesRep&gt;
              {
                  public SalesRepMapping()
                  {
                      ToTable("SalesRep");
                      Property(p =&gt; p.Id).HasColumnName("PKID_SalesRep");
  
                      Property(p =&gt; p.Email).HasColumnName("EMailAddress1");
  
                      Property(p =&gt; p.Address.Address1).HasColumnName("Address");
                      Property(p =&gt; p.Address.Address2).HasColumnName("Address2");
                      Property(p =&gt; p.Address.City).HasColumnName("City");
                      Property(p =&gt; p.Address.State).HasColumnName("State");
                      Property(p =&gt; p.Address.Zipcode).HasColumnName("Zipcode");
                      //Property(p =&gt; p.SalesGroupId).HasColumnName("FK_MasterRepGroup");
                      //HasRequired(p =&gt; p.SalesGroup).WithMany(c =&gt; c.SalesReps).HasForeignKey(b =&gt; b.SalesGroupId);
  
                      //Note: dropping emailaddress2
                  }
              }
  
              class SalesGroupMapping : EntityTypeConfiguration&lt;SalesGroup&gt;
                  {
                      public SalesGroupMapping()
                      {
                          ToTable("MasterRepGroup");
                          Property(p =&gt; p.Id).HasColumnName("PKID_MasterRepGroup");
                          Property(p =&gt; p.Name).HasColumnName("CompanyName");
                          Property(p =&gt; p.PrimaryContact.FirstName).HasColumnName("Contact1FirstName");
                          Property(p =&gt; p.PrimaryContact.LastName).HasColumnName("Contact1LastName");
                          Property(p =&gt; p.PrimaryContact.Phone).HasColumnName("Contact1Phone");
                          Property(p =&gt; p.PrimaryContact.Fax).HasColumnName("Contact1Fax");
                          Property(p =&gt; p.PrimaryContact.Email).HasColumnName("Contact1EMail");
                          Property(p =&gt; p.SecondaryContact.FirstName).HasColumnName("Contact2FirstName");
                          Property(p =&gt; p.SecondaryContact.LastName).HasColumnName("Contact2LastName");
                          Property(p =&gt; p.SecondaryContact.Phone).HasColumnName("Contact2Phone");
                          Property(p =&gt; p.SecondaryContact.Fax).HasColumnName("Contact2Fax");
                          Property(p =&gt; p.SecondaryContact.Email).HasColumnName("Contact2EMail");
                          Property(p =&gt; p.Address.Address1).HasColumnName("Address");
                                      Property(p =&gt; p.Address.Address2).HasColumnName("Address2");
                          Property(p =&gt; p.Address.City).HasColumnName("City");
                          Property(p =&gt; p.Address.State).HasColumnName("State");
                          Property(p =&gt; p.Address.Zipcode).HasColumnName("Zipcode");
                      }
                  }
  
      public class SalesRep: Entity
          {
  
              virtual public string FirstName { get; set; }
              [Required]
              public string LastName { get; set; }
              [Phone]
              virtual public string Phone { get; set; }
              [Phone]
              virtual public string Fax { get; set; }
              [Email]
              virtual public string Email { get; set; }
              virtual public string Notes { get; set; }
  
              virtual public Address Address { get; set; }
  
              //public long SalesGroupId { get; set; }
  
              //[Required]
              ////[ForeignKey("SalesGroupId")]
              //virtual public SalesGroup SalesGroup { get; set; }
          }
  
  public class SalesGroup : Entity
      {
          public SalesGroup()
          {
              //SalesReps = new List&lt;SalesRep&gt;();
          }
  
          [Required]
          public string Name { get; set; }
  
          virtual public Address Address { get; set; }
          virtual public Contact PrimaryContact { get; set; }
          virtual public Contact SecondaryContact { get; set; }
  
          //virtual public ICollection&lt;SalesRep&gt; SalesReps {get; set;}
      }
  
          public abstract class Entity : NMTC.Core.DataContracts.IEntity
              {
  
                  // TODO database columns will eventually be int instead of bigint
                  public long Id { get; set; }
          }
          }
  </code></pre>
  
  <p>Any ideas?  I've been banging my head on this one since Friday. If you know of a way I can track down what it's thinking, that would help, too.</p>
  
  <p>Much appreciated.</p>
  
  <p><strong>More Info:</strong></p>
  
  <p>Commenting out the mapping for the Id property alone will allow the model to be created. That won't actually help long-term, though.</p>