I am writing a multithreaded service that picks up jobs to process that has the status of 1 (unprocessed). As soon as they are picked up, I need to change the status of those rows to 2 (indicates In Progress) so that another thread (that is spawned within a few seconds) does not pick up these rows for processing.
For select, I would do something like this:
var jobs = from j in db.Jobs
where j.Status == 1
select j;
How do I rewrite this to update the rows and also select them at the same time?