Unable to map object with async operations #607
Unanswered
yanosh1982
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm trying to map a source object to a destination DTO with some afterMap async operation as shown here in the documentation
Here is my code
Profile
Repository
Call in service
The afterMap callback, thought , doesn't await for the result of alimentazioneRepository.findById. Instead the execution continues and the 'return result' line got executed back in the service. Finally the debugger goes back to afterMap at line
If i change the call to the repository method with another one that resolves immediately like the following everything works.
Fake call to the repository that resolves immediately
If i change the call to the repository method with another one that simulates a real async call, I get the same behavior of the original call
Fake call to the repository that resolves after some time
I can't figure out what is missing. Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions