This question is locked. New answers and comments are not allowed.
I just started using OpenAccess today after battling with Entity Framework in hopes I could resolve this problem. Alas, it still follows me. I have a Scheduler class that holds several Task objects. These Task objects each old a BackgroundWorker object that does long running processes. Once I get the event from the BackgroundWorker that its job is complete, I raise an event in the Task object.
The scheduler uses the same event handler for every one of these events called NewTaskTaskCompleted (Typo in my method name, will fix later). I keep getting errors in this handler, though. What makes it difficult is that I am getting a different error in different places. Maybe someone can help me out.
I have attached a screenshot of the errors of 3 different runs.
EDIT:
I found that the model generated from the database had some discrepancies and I now am saving successfully if I had one task running. However, if I have multiple tasks running and they all finish at the same time, My NewTaskTaskCompleted function is getting called in quick succession and is causing an
InvalidOperationException - Not allowed because Commit / Rollback is in progress
I am guessing this is because I am calling SaveChanges too fast? Is SaveChanges not a blocking call preventing further execution until the commit is complete?
The scheduler uses the same event handler for every one of these events called NewTaskTaskCompleted (Typo in my method name, will fix later). I keep getting errors in this handler, though. What makes it difficult is that I am getting a different error in different places. Maybe someone can help me out.
I have attached a screenshot of the errors of 3 different runs.
EDIT:
I found that the model generated from the database had some discrepancies and I now am saving successfully if I had one task running. However, if I have multiple tasks running and they all finish at the same time, My NewTaskTaskCompleted function is getting called in quick succession and is causing an
InvalidOperationException - Not allowed because Commit / Rollback is in progress
I am guessing this is because I am calling SaveChanges too fast? Is SaveChanges not a blocking call preventing further execution until the commit is complete?