title: EF edmx inheritance
body: <h2>Use-case</h2>
  
  <ol>
  <li>Implement a DAL around Entity Framework to enable future ORM replacement</li>
  <li>The DAL is to partially expose EF generated classes</li>
  <li>Entity-Framework to be used with Model-First ( DB doesn't exist yet )</li>
  </ol>
  
  <h2>Analysis</h2>
  
  <ul>
  <li>To enable partial exposure of EF generated classes it must be made sure that no EF Navigation props should are exposed out of the context, Also, a subset of the values shouldn't be directly exposed due to security reasons.</li>
  <li>For that, the optimal solution would have been to use inheritance where ~local~ properties are implemented at the Base class and Navigation properties are added to the derived class, this way, the DAL could only expose the base class, elegantly avoiding out of context Navigation prop exposure.</li>
  </ul>
  
  <h2>Example</h2>
  
  <pre><code>class UserInfo
  {
     public int      UserId       { get; set; }
     public string   DisplayName  { get; set; }
     public DateTime CreationTime { get; set; }
     public DateTime LastModified { get; set; }
  }
  
  class UserProfile : public UserInfo
  {
     // I don't want this to be directly exposed out of the DAL
     public string ConfirmationToken { get; set; }
     // Navigation property
     public virtual ICollection&lt;UserVariant&gt; Variants { get; set; }
  }
  
  class DAL
  {
     // Returned value include no navigation properties
     public UserInfo GetUser(int UserId) { ... }
  }
  </code></pre>
  
  <h2>Problem to resolve</h2>
  
  <ul>
  <li>While using Inheritance @ the '.edmx' file I would expect the corresponding DB table to result in accordance with 'UserProfile' however, the Entity Set Name of the derived class ( UserProfile ) is set to the base class ( UserInfo ) omitting the 'confirmationToken'.</li>
  </ul>
  
  <p><strong>Is it possible to define inheritance @ the '.edmx' in such a way that 'UserProfile' will be used as the reference for the DB table rather than UserInfo ?</strong></p>