private void End(bool commit) { if (connection == null) { throw new InvalidOperationException("The transaction is disposed."); } if (ended) { throw new InvalidOperationException("The transaction has already been committed or rolled back."); } connection.EndTransaction(commit); ended = true; }