If you do not start a transaction, it is implicit. Value, all SaveChanges() that you execute will be available in the database right after the call.
If you start a transaction, SaveChanges() is still updating, but the data is not available to other connections until commit is called.
You can verify this yourself by setting breakpoints, creating new objects, adding them to the context, and doing SaveChanges() . You will see that the ID property will have a value after this call, but there will be no corresponding row in the database until you commit the transaction.
As for your second question, it really depends on the needs of concurrency, what your class is doing, and the amount of data you work with. This is not a lot of problems, because the problem is with the execution of the code.
Contexts are not thread safe, so as long as you have only one thread in your application, access to the context, you can make it in a wider area. But then, if other instances of the application access the data, you will need to make sure that you update the data to the latest model. You should also consider that the more models you load into memory, the slower they are saved over time.
I try to create my contexts as close as possible to the operations that should be performed whenever possible, and delete them shortly after.
source share