Hi, I’m trying to determine the best way to implement certain business rules. For most cases, In a command handler, I grab the aggregate in question by it’s id, then perform my checks, then failing or proceeding based on their outcome. But creation scenarios are a little different. Let’s say I have an event sourced Aggregate “User”:
So I have a CreateUserCommmand(id:String,email:String,…). So one of my business rules would be say ensuring that I can’t create a second user with the same email. Since I have no way to ‘search’ my aggregate repo for user, is it ‘ok’ to query the read model? I’m just asking as it’s a bit of a departure from most rules which act on the data in the aggregate instances. It’s also a bit sensitive to timing issues, if I’m using eventual consistency on the read model (I’m not, yet… lol) Any suggestions would be appreciated.