Updating multiple objects in a single transaction in an entity structure

I am adding a set of objects using the entity infrastructure in one context, but want to be in a transaction. How can i do this?

+3
source share
3 answers

You can read How to: Transaction Management in the Entity Framework on MSDN. Basically, you should use the TransactionScope class to demarcate transaction boundaries.

+4
source

SaveChanges , , SaveChanges , (, TransactionScope), , , connection.BeginTransaction.

+2

You can create a transaction object in a context connection object, then you can use a commit transaction or rollback using a regular mechanism or transaction scope.

dbContext.Connection.BeginTransaction()
0
source

All Articles