I'm working on a project to gradually phase out a legacy application. In the proces, as a temporary solution we integrate with the legacy application using the database.
The legacy application uses transactions with serializable isolation level. Because of database integration with a legacy application, i am for the moment best off using the same pessimistic concurrency model and serializable isolation level.
These serialised transactions should not only be wrapped around the SaveChanges statement but includes some reads of data as well.
I do this by
- Creation a transactionScope around my DbContext with serialised isolation level.
- Create a DbContext
- Do some reads
- Do some changes to objects
- Call SaveChanges on the DbContext
- Commit the transaction scope (thus saving the changes)
I am under the notion that this wraps my entire reads and writes into on serialised transaction and then commits.
I consider this a way form of pessimistic concurrency.
However, reading this article, https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application states that ef does not support pessimistic concurrency.
My question is:
- A: Does EF support my way of using a serializable transaction around reads and writes
- B: Wrapping the reads and writes in one transaction gives me the guarantee that my read data is not changed when committing the transaction.
- C: This is a form of pessimistic concurrency right?