I just started working on a project that uses Entity Framework. Prevoiusly, the app passed the EF entities around, and they were fully populated, so each section of code was able to access properties within properties with properties…
I just created domain entities and I want to map the EF entities to these domain entities. It’s basically a 1-1 mapping. How is this supposed to be done? There is a T4 template that will map the EF entities to POCOs, but it only maps one level deep. What if I want to access Person -> Car -> Engine? How am I supposed to go from the EF structure to the POCO structure and have the mapping work all the way through the hierarchy?
In my opinion, you do not need to create another set of domain entities. POCO entities are designed to be used in all layers (IMHO).
But if you want to map another set of entities to POCO entities, just go with Automapper.
It has the ability to map objects and their properties.
On the otherhand, using POCO it is possible to access Person -> Car -> Engine chain. Just make the “include”s properly, and there will be no problem.