The "Two-Way" Mapping Strategy
Learn about the "two-way" mapping strategy and when and how to use it.
We'll cover the following...
A mapping strategy where each layer has its own model is what I call the “two-way” mapping strategy outlined in the figure below.
Two-way mapping
Each layer has its own model, which may have a structure that is completely different from the domain model.
The web layer maps the web model into the input model that is expected by the incoming ports. It also maps domain objects returned by the incoming ports back into the web model.
The persistence layer is responsible for a similar mapping between the domain model, which is used by the outgoing ports, and the persistence model.
Both layers map in two ...