Answer the question
In order to leave comments, you need to log in
Is it possible to store a Value Object inside a Value Objecta?
We consider VO in the context of DDD architectures.
For example, the entity User has a VO Address and it has a VO House in which the fields are apartment and floor.
The first thing that comes to mind is that this cannot be done. to update the Home, you must also delete the parent VO.
What principles are violated?
Answer the question
In order to leave comments, you need to log in
You are confusing two terms. As I understand it, you are contrasting ValueObject and Entity from DDD here.
ValueObject is some value that does not exist by itself in the domain. (eg address). For ValueObject , usually, they do not have a separate table in the database.
Entity is some model of a domain object (for example, a building)
For example, an address and a building:
An address consists of a street name and a house number. The street name and house number are also ValueObjects.
The building has some identifier and a set of attributes, which can be links to other entities, or values - for example, the same address.
And now for your example:
VO Address and it has a VO House in which the fields are an apartment and a floor.
Пользователь:
- Адрес:
- - Дом:
- - - Квартира
- - - Этаж
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question