Entity framework + DDD + UnitOfWork => How to use EF classes as DDD Entities

I have some doubts with the fact that I don’t want to use the EF autogenerated classes for accessing tables as my Domain entities. Of course I want to use EF but only in the DB Infrastructure layer. How do you guys, solve the gap between mapping from Business classes to Model classes? At the moment, I am using Automapper to perform a mapping process inside the repositories implementations, between the Business=> Model classes.

My intention is that ,you guys, expose how are you facing that problem. With their pros and cons.

Using Automapper


  • Decopuling achieved
  • Centralized mapping configuration


  • Loose of some EF features
    • Autotracking of entities
    • The possibility to launch Expression> queries