1

I have some tables in my database and want to insert records in these tables using Entity framework in MVC 4.0. Insertion took place in this way that insertion of record in child table depends on the records in the master table. This functionality could be achieve easily by Transaction and roll-back in the sql server. Where If record could not be insert in any of the table involved in the process then whole insertion process would roll-backed.

I want the alternative of this Transaction and roll-back with Entity framework in MVC 4.0.

Please provide some suggestions.

Thank you,

Regards, Ashish

1 Answers1

2

If you only call one SaveChanges after multiple statements, it will wrap all of them in one transaction. And the transaction will use whatever isolation level the database provider considers its default setting.

Here is a very detailed article about EF transaction.

J.W.
  • 17,991
  • 7
  • 43
  • 76