stories
stories copied to clipboard
Entities should not know their primary key.
- If we read a record from the database we already know primary key of the entity.
- If we create a record in the database, the primary key will be returned by the repository.
- If we delete a record, we do not need entity at all.
- If we update an entity, new fields are known outside of the entity together with the primary key. The new entity will be produced by an old entity using its method and evolve call.
The main purpose of entities is not to store the data, but expose behavior related to it.