I am using Visual Studio 2015 with Entity Framework 6 on an N-Layered solution which contains the following projects:
MyProj.UI
MyProj.Application
MyProj.Domain
MyProj.DAL
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.
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:
- A) Those created by the Database First tool in the DAL project layer
- B) Those copied to the Domain project layer from the DAL project layer's EntityMOdels.tt structure to be modified with behaviors
I consider the two separate sets of entities as follows:
- A) Data Entities (those in the DAL layer)
- B) Domain Model Entities (those in the Domain layer)
Is this typically how things are setup when working with Entity Framework in a layered design?