Does this mean entities? There is no need to have the required Id field (because of its infrastructure issues). Under what circumstances are entity comparisons required? As he mentioned in most cases, it may not be needed.
[Edit] When I mentioned that the ID is not needed, the build entity is wrt, that is, I can use the new object (order = new Order) test my logic without passing Guid or Id. Ideally, db will generate a persistent Id.
However, Its ID is used by the outside world. Almost any client code (demo, application, or infrastructure) that uses an entity will use its ID. Without an ID, the client code will not be able to find the entity in the collection of all entities. p>
Even the domain-level code uses this ID. For example, in Aggregate, the Aggregate root uses the ID when it finds a nested Entity, even if it is just a simple integer key.
Update: In the real world, as a human entity, when you eat, drink, sleep or do anything alone, do you need your social security number (or any ID card you have)? No, it has nothing to do with the working rules of human organisms. Other human entities need you to distinguish IDs from others.
Eric Evans said in the plural sight video: ” I have begun to believe that an entity should not even be compared for equality”.
Does this mean that the entity does not need to have the required Id field (because of its infrastructure issues). Under what circumstances does the entity need to be compare? As he mentioned in most cases, it may not be needed.
[Edit] When I mentioned that the ID is not needed, the build entity is wrt, that is, I can use the new object (order = new Order) test my logic without passing Guid or Id. Ideally, db will generate a persistent Id.
In theory, the entity It shouldn’t care about its ID; when an entity queries or uses its own ID, there are no use cases in my mind now.
However, its ID is used by the outside world. Almost anything that uses an entity The client code (demo, application, or infrastructure) will use its ID. Without an ID, the client code will not be able to find the entity in the collection of all entities.
Even the domain layer code uses this ID. For example, in Aggregate, Aggregate root uses ID when it finds nested Entity, even if it is just a simple integer key.
Update: In the real world, as a human entity, when you Do you need your social security number (or any ID card you have) when eating, drinking, sleeping or doing anything alone? No, it has nothing to do with the working rules of human organisms. Other human entities need you to distinguish IDs from others.