When running the AbsenceMonitorJob, when raising a command to SendAbsenceNotificationToParent, the handler cannot load the absence as it has not yet been persisted to the database.
Persist the absence before sending the notifications, which will prevent a notification failure from blocking the absence being persisted
Pass the absence as a parameter of the command, allowing the handler to ignore the database
Prefer option 1 as this ensures the data is complete in the persistence store, even if the notification fails to send. Perhaps look at moving the notifications to a domain event so they can be handled out-of-band. This will require that each absence is sent as a separate email which may be an issue.
When running the AbsenceMonitorJob, when raising a command to SendAbsenceNotificationToParent, the handler cannot load the absence as it has not yet been persisted to the database.
Prefer option 1 as this ensures the data is complete in the persistence store, even if the notification fails to send. Perhaps look at moving the notifications to a domain event so they can be handled out-of-band. This will require that each absence is sent as a separate email which may be an issue.