title: Entity Framework - Abstract base class without mapping to DB table
body: <p>I have a situation where I have 4-5 very similar classes which I'd like to re-factor to use an abstract base class. 
  The idea behind this would be allow methods which could be used by each class whilst adhering to DRY principles.</p>
  
  <p>The problem I have is that these classes are Entity classes generted from EF4 and each time I try to alter my model it seems to break down. </p>
  
  <p>What's the best/recommended, method to add a base class into my EF model and make the existing classes in the model inherit from this as a base? At the moment I've got no problem adding the base class, giving it an ID property as it seems to require, and then creating the inheritence, but EF then moans about</p>
  
  <p><code>'Error 3024: Problem in mapping fragments starting at line 18563:Must specify mapping for all key properties (MyBaseType.ID) of the EntitySet MyBaseType.'</code></p>
  
  <p>In this situation I don't want the base type to be persisted to the DB, purely used as a container for base methods common to all the classes which inherit from it. It feels like I'm missing something simple here but I can't for the life of me see it.</p>
  
  <p>Any ideas on how to add in a base class in this way? Or should I just be adding the base class in code and bypassing the model somehow?</p>
  
  <p><strong>EDIT:</strong> As further information, take an example where there are say 3 types, MortageApplicationForm, BankAccountApplicationForm and CreditCardApplication form. They are currently stored in 3 different tables, with a set of different fields. 
  What I'm trying to do, is create a base class of say 'Form' which will have the common fields in it. </p>
  
  <p>At a simple level, say that each table has a primary key ID field called, 'CreditCardFormID', 'BankAccountFormID' etc What I'd like to do it create a base 'Form' class with a property 'ID' which for the case of one table will map to 'CreditCardFormID' and another 'BankAccountFormID'. </p>
  
  <p>I'm happy to do this mapping in partial classes (as I don't want to persist 'ID' to the DB) I simply want to use it in code, so I can write generic methods for things like LoadForm(int ID) without needing to write huge switches for each entity type, or specific methods for each entity type.</p>