I have a requirement, such that I need to do some synchronous processing within a parallel execution flow.
I have some tasks working within a Parallel foreach. Now what I need to do is that, in between do some database updates. Which I do not want to be done using async and await, since this would invoke multiple threads and loading my server.
Since these database updates are important for me, but I do not want them to block my main flow of execution. What I want to achieve is that the database updates should always be done on the same thread synchronously, which would fasten the main flow.
Is this possible while I use a Task? If so, can anyone please suggest on the same.