Unintended consequences - Transactions
What’s wrong with the following code? using (var transaction = session.BeginTransaction()) { session.Save(something); transaction .Commit(); } Nothing if you are using MySQL connector 6.0, which has the following Dispose method on its MySqlTransaction class. protected override void Dispose(bool disposing) { if ((((this.conn != null) && (this.conn.State == ConnectionState.Open)) || this.conn.SoftClosed) && this.open) { this.Rollback(); } base.Dispose(disposing); } But if you are using 5.0.9, check out this code (which is actually from the underlying DbTransaction object). »