title: Entity Framework, Table Per Type and Linq - Getting the "Type"
body: <p>I have an Abstract type called Product, and five "Types" that inherit from Product in a table per type hierarchy fashion as below:</p>
  
  <p><img src="https://i.stack.imgur.com/3MwSS.png" alt="Table Per Type"></p>
  
  <p>I want to get all of the information for all of the Products, including a smattering of properties from the different objects that inherit from products to project them into a new class for use in an MVC web page. My linq query is below:</p>
  
  <pre><code>     //Return the required products
      var model = from p in Product.Products
                  where p.archive == false &amp;&amp; ((Prod_ID == 0) || (p.ID == Prod_ID))
                  select new SearchViewModel 
                      {
                          ID = p.ID,
                          lend_name = p.Lender.lend_name,
                          pDes_rate = p.pDes_rate,
                          pDes_details = p.pDes_details,
                          pDes_totTerm = p.pDes_totTerm,
                          pDes_APR = p.pDes_APR,
                          pDes_revDesc = p.pDes_revDesc,
                          pMax_desc = p.pMax_desc,
                          dDipNeeded = p.dDipNeeded,
                          dAppNeeded = p.dAppNeeded,      
  
                          CalcFields = new DAL.SearchCalcFields
                          {
                              pDes_type = p.pDes_type,
                              pDes_rate = p.pDes_rate,
                              pTFi_fixedRate = p.pTFi_fixedRate 
                          }
                      }
  </code></pre>
  
  <p>The problem I have is accessing the <strong>p.pTFi_fixedRate</strong>, this is not returned with the Products collection of entities as it is in the super type of Fixed. How do I return the "super" type of Products (Fixed) properties using Linq and the Entity Framework. I actually need to return some fields from all the different supertypes (Disc, Track, etc) for use in calculations. Should I return these as separate Linq queries checking the type of "Product" that is returned? </p>