I’m now starting out on DDD, I’ve already found a nice implementation for ValueObject but I cant seem to find any good implementation for Entities, i want a generic base entity type which will have an ID(needed by the specification) and implement currect equality operations.
Whats the most elegent solution?
The only characteristic of an Entity is that it has a long-lived and (semi-)permanent identity. You can encapsulate and express that by implementing
IEquatable<T>. Here’s one way to do it: