In a project I am working on, I have 3 layers of domains.
MVC 5 App [Has Reference]-> Class Library [Has Reference]-> Data access layer (Entity Framework).
- DAL has POCOs
- Class Library Has DTOs
- MVC App has ViewModels
For example, I have a very basic person class for each Layer, and I am using Auto Mapper map like;
CreateMap<POCO,DTO> //(in class library)
CreateMap<DTO,ViewModel> //(in MVC app)
Since this person class is very basic, all three layers has almost identical class definitions. As my project grows, there are more classes started have same structure on all layers. And I am mapping same class definitions from one to another.
There are some complex classes that makes sense to have 3 different definitions on each layer but classes like this "person" class makes me thing if this is a acceptable approach to define same class definitions on each layer.
I know this questions looks like candidate of a "broad topic" question, but I could not find clear definition or a blog post online. Since books are mostly focused on one of these layers, I could not find a compherensive coverage on this.
Shortly, even for basic entity classes, what would be to good approach for class definitions on each layer?