If the data is coming from somewhere else, but is required to do a particular task, then usually I would have some repository or something that will fetch the data I need and then include that as part of the value object's dependencies.
Sometimes, if this means returning too much data, then having a repository with a method that returns a bool might be a better choice?
If the data is coming from somewhere else, but is required to do a particular task, then usually I would have some repository or something that will fetch the data I need and then include that as part of the value object's dependencies.
Sometimes, if this means returning too much data, then having a repository with a method that returns a
bool
might be a better choice?Usually, that's my approach; I have a validate method in the repo returning a tuple from there.