title: Using a navigation property as discriminator in a TPH inheritance scenario in Entity Framework 4
body: <p>I am trying to create a TPH inheritance hierarchy using foreign keys / navigation properties as discriminators and I am having some trouble getting it right.</p>
  
  <p>I have the following entities:</p>
  
  <pre><code>Person:
    Id (int)
    Name (nvarchar)
    PlaneId (int)
    CarId (int)
  
  Car:
    Id (int)
    Name (nvarchar)
  
  Plane:
    Id (int)
    Name (nvarchar)
  </code></pre>
  
  <p>with <code>PlaneId</code> and <code>CarId</code> beign FKs. I have corresponding tables in a database and I can create a conceptual model using the VS2010 EF wizard. The <code>Person</code> entity then has two navigation properties, <code>Car</code> and <code>Plane</code>.</p>
  
  <p>Now I want to derive two types from Person: </p>
  
  <pre><code>Pilot (condition: PlaneId is not null)
  Driver (condition: CarId is not null)
  </code></pre>
  
  <p>So, I add the entity Pilot, tell it to map to Person and add the condition <code>PlaneId is not null</code>. At this point Visual Studio (or edmgen I guess) complains that the property <code>Person.PlaneId with 'IsNull=false' condition must be mapped</code>. </p>
  
  <p>What is my next step? I have tried various approaches, but can't seem to get it to work. Any insight would be greatly appreciated.</p>