title: Domain Model Entities and Entity Framework Generated Entity Models In N-Layered Design
body: <p>I am using Visual Studio 2015 with Entity Framework 6 on an N-Layered solution which contains the following projects:</p>
  
  <pre><code>MyProj.UI
  MyProj.Application
  MyProj.Domain
  MyProj.DAL
  </code></pre>
  
  <p>In my DAL project, I have used the Entity Framework Database First tools to generate an EntityModels.edmx structure which includes EntityModels in a folder called EntityMOdels.tt.  </p>
  
  <p>I would like to have entities in my domain layer to act as domain entity models where I can add behavior to them. For now it looks like I can copy all the entity classes in the EntityModels.tt structure to my domain project layer where I can modify them as needed. I don't want to use the entities in the DAL layer created by Entity Framework for my Domain because they get overwritten by the designer on actions such as validation of an entity.  If I do this, then I basically will have entities in at least 2 places: </p>
  
  <ul>
  <li>A) Those created by the Database First tool in the DAL project layer</li>
  <li>B) Those copied to the Domain project layer from the DAL project
  layer's EntityMOdels.tt structure to be modified with behaviors</li>
  </ul>
  
  <p>I consider the two separate sets of entities as follows:</p>
  
  <ul>
  <li>A) Data Entities (those in the DAL layer)</li>
  <li>B) Domain Model Entities (those in the Domain layer)</li>
  </ul>
  
  <p>Is this typically how things are setup when working with Entity Framework in a layered design?</p>