I want to set the entity structure so that SavesChanges () does not wrap all of its generated SQL with BEGIN and COMMIT. I came across this suggestion from a related SO question :
using( var transation = new TransactionScope(TransactionScopeOption.Suppress) ) { ObjectContext.SaveChanges(); }
But this does not work for me. We use the MYSQL connector, so I did some digging by going through the source code, and I found that EntityFramework is the one that asks to create a new transaction, not a socket failure, see the next stack trace. 
Next, I began to study the source code for EF (EF 6 is open source, and the corresponding code looks the same in the decompiler)
var needLocalTransaction = false; var connection = (EntityConnection)Connection; if (connection.CurrentTransaction == null && !connection.EnlistedInUserTransaction && _lastTransaction == null) { needLocalTransaction = startLocalTransaction; } ... if (needLocalTransaction) { localTransaction = connection.BeginTransaction(); }
Well, it looks like this, if the transaction does not exist, it creates it. Moving on to how the current transaction is configured in EF, I get a code in which EF establishes a connection
var currentTransaction = Transaction.Current; EnsureContextIsEnlistedInCurrentTransaction( currentTransaction, () => { Connection.Open(); _openedConnection = true; _connectionRequestCount++; return true; }, false);
And this seems to be the only place where the string "TransactionScopeOption.Suppress" is included, however everything that does this sets the external transaction (Transaction.Current) to zero. Forcing EF not to see the transaction and do the opposite of what I want and create a new transaction.
Is anyone else lucky with disabling a transaction in EF 5, or is my only solution to hacking and building my own version of sql connector?
Thanks!