Lets go through all your layers:
- Data Access Layer (DAL). It is used in order to get data from database (DB).
Usually it knows about Domain Entities
and Domain Layer.
The DAL can return either Domain Entities
or DTOs (DB oriented data structures)
. These DTOs or Domain Entities can be used in order to build DTOs of Presentation Layer (view models
) if it is needed.
Domain Entities usually are heavy and require data mappers or any ORM. I prefer working with Domain Entities
, map them and avoid other DTOs. Otherwise DTOs should be mapped also.
- Domain Layer (Domain model). It is used in order to represent Business entities and their behaviour, business rules, pure business logic.
Domain Layer should know nothing about the way the entities are stored somewhere (e.g. in DB). It can have its own DTOs which can be results of refactoring Introduce Parameter Object.
- Presentation Layer (UI). It is used in order to present UI to users.
It should know about Data Access Layer
to load data from DB and about Domain Layer
to have access to its business logic.
It can have its own DTOs - view models, which are user interface friendly representation of Domain Entities or DB friendly DTOs. It is responsibility of Presentation Layer to know about view models
.
If you are going to have only one presentation your Application Infrastructure can be implemented as part of presentation layer also, but usually it is a separate Application Layer.