Answer the question
In order to leave comments, you need to log in
Entity vs Value Object DDD?
Hello! I am developing an application on asp.core to work with requests. I'm trying to apply DDD.
There is uncertainty in some decisions. I will try to briefly describe the entities.
There are two main aggregates `User` and `Ticket`
```
```
public class User
{
public UserId Id { get; private set; }
public FullName FullName { get; private set; }
public DateTime BirthDate { get; private set; }
public Group Group { get; private set; }
...
}
public class Ticket
{
public TicketId { get; private set; }
public Group Group { get; private set; }
...
}
Answer the question
In order to leave comments, you need to log in
1. The difference between VO and Entity is that it can be identified by Id. Also, the structure of VO does not change over time. For example, VO Email will be the same anywhere and its logic will not change for a long time.
2. It depends on how you use these Groups. If you need these groups somewhere in your application, then it is better to create them as a separate entity/aggregate. But you can also make them VO in the Ticket entity and store only the Group ID, or the group name itself. It all depends on how you deal with it in your context. For example, in the context of directories, Group can be an entity, and this is normal. And in the Ticket context, you can only store the ID or the value itself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question