Skip to content
Mehdi Hadeli edited this page May 4, 2023 · 26 revisions

DDD

Articles

Notes

  • we should do validation inner factory method instead of constructor
  • Kamil Twitter: If you put validation in ctor and this ctor is used by your infrastructure to instantiate your persisted object then when you change validation you could not be able to load this object. This is why FactoryMethod is better. The second reason is that method has a name, ctor not.
  • Kamil Twitter:
  1. Pass all names as you described
  2. Pass all names which have the same entity name
  3. Pass an interface called IUniquenessChecker which will return the number of entities with that name
  4. Pass the function <name, number> (the same as 3 but the more functional way)
  5. Aggregate

Videos

Clone this wiki locally