title: Entity Framework Database first How to alter entities to make them derive from a base class
body: <p>I have a database already full of tables with data in them. What I have seen is that all tables have 5 columns in common: </p>
  
  <ul>
  <li>Id-long, key</li>
  <li>IsDeleted, bit</li>
  <li>DateDeleted, SmallDatetime</li>
  <li>LastUpdated, SmallDatetime</li>
  <li>LastUpdatedUser, nvarchar</li>
  </ul>
  
  <p>Now, there are some common operations that are done based on those fields which currently are replicated everywhere</p>
  
  <p>What I want is to create a base class containing just these common attributes and the methods done to them and make every other entity derive from this.</p>
  
  <p>I don't need or want to have this base entity on the database per se, this is just something I want to help the coding part.</p>
  
  <p>The issue is this is Database first, I cannot alter the database so all I have to work with are the POCO classes and the EDMX.</p>
  
  <p>How can i achieve this?</p>