EF's savechanges do have transactional features, and this 3-story link contains:
Versions of the Entity Framework, whenever you execute SaveChanges () to insert, UPDATE or delete on the database the F Ramework would wrap that operation in a transaction. This transaction lasts only a long enough to execute the operation and then completes. When you execute the another such operation a new transaction is started. "
But the business must also need the support of the bottom of the ADO provider, LZ's problem is the provider inside the MySQL reported errors. This can find some of the same problems, it seems that the EF transaction mode and MySQL. NET connector is not very compatible, MySQL has a report on this bug, the solution is to use TransactionScope, but I did not try.
Today we found the root of the problem. In fact, the transaction-related code here is not much error, the root cause of the transaction is invalid is the current MySQL database engine does not support the transaction!!! Look at the engine type of the table you need to use for the transaction:
SHOW TABLE STATUS from db_name WHERE name= ' table_name ';
If the value of the engine column in the result is not "InnoDB", then you will not be in the code to write the relevant transaction code in any way! The table's engine needs to be modified to a INNODB transaction to be valid, modifying the statement:
ALTER TABLE enginetest ENGINE = INNODB
I hope to be helpful to the people I see later.
http://bbs.csdn.net/topics/390982230
EF Framework Multiple Table save