Domain Driven Design Entity Validation
In his book implementing domain driven design vaughn vernon discusses these in the section on validation.
Domain driven design entity validation. In domain driven design there are two schools of thought regarding validation which revolve around the notion of the always valid entity. You can do this by returning a result object instead of exceptions in order to make it easier to deal with the validation errors. Jeffrey palermo proposes that the always valid entity is a fallacy. The other school of thought.
2012 04 03 12 31 by mickael marrache. Use field level validation on your command data transfer objects dtos and domain level validation inside your entities. If the validation rules form part of the business domain they belong in the model. If you find that the validation rules are very complex you can create a validation service that will be.
Par exemple un objet d élément de commande doit toujours avoir une quantité qui doit être un entier positif ainsi qu un nom d article et un prix. An aggregate root is responsible of maintaining the invariants encompassed by it so validating them falls under its responsibility. Pour un objet il existe un certain nombre d invariants qui doivent toujours avoir la valeur true. Also consider two step validation.