I need to read and write from/to a tasks table from multiple threads. These threads are consumers of the tasks table and remove and update tasks from it. They update the table to "own" a task and remove it from the table when it has finished executing.
I have been reading about the quirks I could find when having some threads working on the same table with entity framework core and I have noticed that DbContext is not thread save. So, I must have a DbContext per thread.
The problem I am foreseing is what happens when a thread is updating a row to assign it to a queue but at the same time another thread is trying to assign that tasks to another queue.
Is there anyway to lock rows? Is this something that entity framwork does in the background when accesing the row?. I would like to have a little overview of the problem before coding all the system.
P.D. I'm using mysql backend with pomelo driver.