title: Same table name different schema
body: <p>I have the following tables in my database, all with the same table name but different schema's.</p>
  
  <ul>
  <li>dbo.Versions </li>
  <li>bpm.Versions </li>
  <li>wf.Version</li>
  <li>...</li>
  </ul>
  
  <p>All x.Versions have a FK to the Version table. </p>
  
  <p>I've created the POCO classes from it (this gave me classes like Version, Version1, .... - - I've renamed the classNames to Version and BPMVersion, .... but the mapping still exists to the right table. </p>
  
  <p>This is an example of my mapping of BPMVersion that maps to bpm.Versions</p>
  
  <pre><code>// Primary Key
  this.HasKey(t =&gt; t.Id);
  
  // Properties
  // Table &amp; Column Mappings
  this.ToTable("Version", "bpm");
  this.Property(t =&gt; t.Id).HasColumnName("Id");
  this.Property(t =&gt; t.VersionId).HasColumnName("VersionId");
  this.Property(t =&gt; t.BPMId).HasColumnName("BPMId");
  
  // Relationships
  this.HasRequired(t =&gt; t.BPM)
      .WithMany(t =&gt; t.BPMVersions)
      .HasForeignKey(d =&gt; d.BPMId);
  this.HasRequired(t =&gt; t.Version)
     .WithMany(t =&gt; t.BPMVersions)
      .HasForeignKey(d =&gt; d.VersionId);
  </code></pre>
  
  <p>When creating the Migration script, I've got the following exception: 
  <strong>The entity types 'BPMVersion' and 'Version' cannot share table 'Versions' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them.</strong></p>
  
  <p>I found the following blogs on the internet, it seams that EF has a problem with tables with the same name but different schema (<a href="https://entityframework.codeplex.com/workitem/1641" rel="noreferrer">https://entityframework.codeplex.com/workitem/1641</a> and <a href="http://geekswithblogs.net/tonyt/archive/2013/07/02/153327.aspx" rel="noreferrer">http://geekswithblogs.net/tonyt/archive/2013/07/02/153327.aspx</a> )</p>
  
  <p>Is there anyway to avoid this problem without renaming the table names? </p>