title: Entity Framework - Inheritance
body: <p>I am just starting with Entity Framework and have the following problem:</p>
  
  <p>I have a <em>Site</em> entity which contains a navigation property <em>Paragraphs</em>.</p>
  
  <p>I have multiple entities (i.e. <em>ImageParagraph</em>, <em>LinkListParagraph</em>) that should be inherited form <em>Paragraph</em>.</p>
  
  <p>I would like to query for a <em>Site</em> object and access its <em>Paragraphs</em> and work with them depending on their concrete type (i.e. <em>ImageParagraph</em>, <em>LinkListParagraph</em>).</p>
  
  <p>It would work with a Table Per Hierarchy approach (with conditions), but then i would end up in a very dirty solution. Querying for the concrete type based on the Paragraph ID would work, but I hope there is a way better solution.</p>
  
  <p>I want to query for a <em>Site</em> and show some Site specific data and the data in the Paragraphs (<em>ImageParagraph</em>, <em>LinkListParagraph</em>). I do not know how to set up the mapping in a way that it is possible to retrieve <em>ImageParagraph</em>, <em>LinkListParagraph</em> objects directly over the <em>Paragraphs</em> navigation property. </p>
  
  <p>How would you solve this problem? </p>
  
  <p>ER-diagram: <a href="http://img443.imageshack.us/img443/46/69863714ks0.jpg" rel="nofollow noreferrer">http://img443.imageshack.us/img443/46/69863714ks0.jpg</a></p>
  
  <p><a href="http://img443.imageshack.us/img443/46/69863714ks0.jpg" rel="nofollow noreferrer">alt text http://img443.imageshack.us/img443/46/69863714ks0.jpg</a></p>