Address book example, name claim issue

In Address book example, you use ClaimedContactName to ensure unique names. But the claim is done in command handler which would result, if using event sourcing, in the empty table of names if we wanted to replay all the events. This is a state change, and it is not handled by an event handler, this contradicts the whole event-sourcing/cqrs rules I’ve read.

Shouldn’t this be handled better somehow and actually change it in the example, so we are not being taught the bad ways?

Hi Radek,

not all information in the repositories has to be event sourced. CQRS itself doesn’t say anything about that. The essence is that command are separated from the queries.
The important point here is how certain guarantees can be made. If it’s absolutely important that something is unique, the command model needs to accommodate that. One way to do that, is keep a “registry” of used names. That part doesn’t need to be event sourced, although it could be.