title: Can EntityObject be sub-classed?
body: <p>I'm basically re-asking <a href="https://stackoverflow.com/questions/2240038/add-custom-abstract-base-class-between-entityobject-and-generated-classes-in-ent">this question</a> as the only and accepted answer is not an answer to the question.</p>
  
  <p>Is it possible to tell EF to use a class that subclasses EntityObject, like the one below, as the base class of generated entity classes?</p>
  
  <pre><code>public abstract class CustomEntityObject : EntityObject
  {
      &lt;additional functionality&gt;
  }
  </code></pre>
  
  <p>The reason I'm asking is I want to stop adding interfaces and implementing them on all entity types in separate partial class files. By sub-classing EntityObject I could implement the additional functionality once only.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>EF implicitly uses a .tt file to generate entity classes. By implicitly I mean you don't see  the .tt file in your project. The solution is to add the template explictly (right-click on the .edmx designer and click "Add Code Generation Item...", then add "ADO.NET EntityObject Generator"). You then change a single value in the .tt:</p>
  
  <pre><code>string BaseTypeName(EntityType entity, CodeGenerationTools code)
  {
      return entity.BaseType == null ? "EntityObject" : MultiSchemaEscape((StructuralType)entity.BaseType, code);
  }
  </code></pre>
  
  <p>changes to:</p>
  
  <pre><code>string BaseTypeName(EntityType entity, CodeGenerationTools code)
  {
      return entity.BaseType == null ? "CustomEntityObject" : MultiSchemaEscape((StructuralType)entity.BaseType, code);
  }
  </code></pre>