title: Entity Framework: Inheritance with same name for parent and child primary key
body: <p>I am trying to make Entity Framework inheritance between two tables.</p>
  
  <p>The parent:</p>
  
  <pre><code>ParentTable
    Id: int primary key
    CustomAttribute: int
  </code></pre>
  
  <p>The Child: </p>
  
  <pre><code>ChilTable
    Id: int primary key (not the same one as the parent, Child specific Id)
    TCId: int foreign key to parent
    SomeInformation: String
  </code></pre>
  
  <p>For some reasons I want to keep naming "Id" the primary key of both the ParentTable and the ChildTable. That should not bother EntityFramwork as I created a custom property with another name "CId" for the child Table: </p>
  
  <p><img src="https://i.stack.imgur.com/THxH8.png" alt="enter image description here"></p>
  
  <p>And the Child1 table mapping is the following: </p>
  
  <p><img src="https://i.stack.imgur.com/b8ogO.png" alt="enter image description here"></p>
  
  <p>But when I "Validate" the model, VS2010 says...: </p>
  
  <pre><code>Error 3002: Problem in mapping fragments starting at line 103:Potential runtime violation of table Child1's keys (Child1.Id): Columns (Child1.Id) are mapped to EntitySet Parents's properties (Parents.CId) on the conceptual side but they do not form the EntitySet's key properties (Parents.Id).
  </code></pre>
  
  <p>Basically, I understand that Entity Framework sees a problem in the fact we map a table's primary key to a property that's not the key of the Entity but then how are we supposed to use inheritance?</p>
  
  <p>IS inheritance only allowed when there is no primary key in the "Child" table? Should I but my primary key as "simple key"?</p>
  
  <p>Thanks in advance... </p>