DDD recognises that there might need to be some implementation compromises to work with the database, but the overall aim is to keep the focus on the business problems.The other issue that effects the approach used is that the actual data saved in the database will be designed for the business layer.In C# Extension methods are a great tool for building Query Objects.If you have seen LINQ fluent commands then that is how extension methods work.
Realising that there were different parts was a breakthrough as I could now design different ways to interface to EF to meet the different requirements.
DTOs are also good at dealing with the issue of Aggregates, that is a class that has subclasses under it.
For instance you might have a class called Order, which has collection of Line Items under it, and most likely a link to a Customer.
However the issue is – what replaces the good bits of the repository, like handling Domain-Driven Design (DDD) which tries to treat the data persistence library as a simple in-memory collection.
This means we want to hide some of EFs code, but still be able to use all of its features.