How do you validate commands based on the aggregate state?

I would like to change the state of a property in my aggregate lets say called IsActive, I would like to set it to false if only if IsActive is currently true. How would do such sort of command validation? Do you query the Event Store for the current state of the aggregate or query the read store from the aggregate class?

Also, I am going through some of the questions here and people are only changing the state in the read store without applying the event? why would you do that? Shouldn’t both the states in read and event store match up at the end?

The only place where you can do that type of validation, is in the aggregate itself. The aggregates (in the command model) aren’t allowed to expose their state, so there isn’t any other place you can do it. The state maintained by the aggregate (which is initialized using events, when using event sourcing), should be sufficient to do this validation.

I don’t think anyone changes the read model state without an event being applied. Events are applied in the command model, and then published to the read model updaters. They pick up those events and change the model accordingly.