Managed to figure it out myself. I just needed to change the calling code to this:
UpdateStatus status = UpdateStatus.Ready;
CandidateExportUpdateEventData eventData = new CandidateExportUpdateEventData { candidate = (ProfileCandidate)objectValue, status = status };
await EventBus.TriggerAsync(eventData);
return eventData.status;
Now I can retrieve the status returned from the eventData.
Hi Hikalkan. It looks like the InsertAsync is locking the database table until CreateCandidateAsync has fully completed, which means when the event tries to update the candidate it can't find it. A colleague suggested changing
_unitOfWorkManager.Current.Completed
to
_unitOfWorkManager.Current.Disposed
This ensures the event doesn't fire until after the candidate has been added to the database, but also means there is an error when attempting to update the candidate because the UserManagerProxy has been disposed of.
Is there a way I can recreate the UserManagerProxy, or stop it from being disposed of in the first place?
Hi Hikalkan. It looks like the InsertAsync is locking the database table until CreateCandidateAsync has fully completed, which means when the event tries to update the candidate it can't find it. A colleague suggested changing
_unitOfWorkManager.Current.Completed
to
_unitOfWorkManager.Current.Disposed
This ensures the event doesn't fire until after the candidate has been added to the database, but also means there is an error when attempting to update the candidate because the UserManagerProxy has been disposed of.
Is there a way I can recreate the UserManagerProxy, or stop it from being disposed of in the first place?