CQRS/DDD: Checking referential integrity

Viewed 956

Should a command handler also check for referential integrity? This FAQ suggest that you shouldn't check this in the aggregates (http://cqrs.nu/Faq). Isn't checking that something exists part of the validation?

For example you can have an application where you can add comments to an article.

The command would have these fields:

  • Id
  • ArticleId
  • UserId
  • Text

For this example the comment and article are a different aggregateroot.

Should you check for this example if the article already exists and the user exists? It feels a bit strange that you can add a comment to an article that doesn't exists.

2 Answers
Related