Checking to see if aggregate exists based on properties #955
Unanswered
jessemillerrev
asked this question in
Q&A
Replies: 1 comment
-
It depends on how consistent you need the state to be up to date i.e. are you bulk creating the regions or do they come one at a time with at least a few milliseconds between each. If it isn't time sensitive and some inconsistency isn't an issue, then why not rely on the read side to give you this information? If a duplicate region would cause significant issues and/or is likely based on the speed at which regions are created, then an option is to make the AggregateId deterministic based off of the region code. EventFlow already caters for this using the Guid helper methods from bytes. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to check to see if an aggregate exists with a certain unique property (besides the AggregateId) so I know whether to create a new aggregate or not? Essentially I have a Region aggregate with a RegionCode property that must be unique. As I am importing a large data set which includes Region data I need to check to see if the region code associated with the current importing record already exists. If it does exist I just move on but if it doesn't exist I want to call a command (using a saga most likely) to generate the missing region based on data that was passed in.
Beta Was this translation helpful? Give feedback.
All reactions