internal SQLiteEnlistment( SQLiteConnection cnn, Transaction scope, System.Data.IsolationLevel defaultIsolationLevel, bool throwOnUnavailable, bool throwOnUnsupported ) { _transaction = cnn.BeginTransaction(GetSystemDataIsolationLevel( cnn, scope, defaultIsolationLevel, throwOnUnavailable, throwOnUnsupported)); _scope = scope; _scope.EnlistVolatile(this, System.Transactions.EnlistmentOptions.None); }
/////////////////////////////////////////////////////////////////////////// private void Cleanup(SQLiteConnection cnn) { if (_disposeConnection) cnn.Dispose(); _transaction = null; _scope = null; }
/////////////////////////////////////////////////////////////////////////// private /* protected virtual */ void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// if (_transaction != null) { _transaction.Dispose(); _transaction = null; } if (_scope != null) { // _scope.Dispose(); // NOTE: Not "owned" by us. _scope = null; } } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } }
/// <summary> /// Initializes a command with the given SQL, connection and transaction /// </summary> /// <param name="commandText">The SQL command text</param> /// <param name="connection">The connection to associate with the command</param> /// <param name="transaction">The transaction the command should be associated with</param> public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction) { _commandTimeout = 30; _parameterCollection = new SQLiteParameterCollection(this); _designTimeVisible = true; _updateRowSource = UpdateRowSource.None; if (commandText != null) CommandText = commandText; if (connection != null) { DbConnection = connection; _commandTimeout = connection.DefaultTimeout; } if (transaction != null) Transaction = transaction; SQLiteConnection.OnChanged(connection, new ConnectionEventArgs( SQLiteConnectionEventType.NewCommand, null, transaction, this, null, null, null, null)); }