T
T
trauus2019-01-30 19:27:41
Database
trauus, 2019-01-30 19:27:41

How to map from domain layer to storage layer?

I study materials on DDD and the organization of application layers. Often there is a recommendation not to drag any things from the storage layer into the domain layer. Do I understand correctly that this means that the domain object should not have an ID property that is needed only for the storage layer, but is not used in the domain layer? Then if the domain object has changed and you need to do an Update in the database, then how will the storage layer understand which record with which ID to update in the database? Do I have to keep a separate dictionary for matching "domain object" - "ID"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
developer007, 2019-01-30
@developer007

Entity is a joke that has an ID (ORDER)
Value Object is a thing without an ID (order address)
In repositories / services you operate Entity
Between layers you communicate using DTO
Here is an interesting example https://github.com/rdehnhardt/ddd-example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question