"This means that repository interfaces for query handlers cannot be in the Domain layer" - no, I would rather say this means that DTO-returning services aren't repositories as DDD envisioned them. A repo is supposed to provide you with initial access to a domain object or an aggregate you cannot otherwise navigate to, and the querying/mapping happens under the hood. There's some friction here when you're using an ORM, so in practice, teams often end up with database-centric code, and treat ORM entities as (anemic) domain objects. Not an unreasonable thing to do, but has its drawbacks.
↧