protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { UtlDataReader target = null; if (this._activeReader != null) { try { target = this._activeReader.Target as UtlDataReader; } catch (InvalidOperationException) { } } if (target != null) { target.DisposeCommand = true; this._activeReader = null; } else { this.Connection = null; } } }
public UtlDataReader ExecuteReader(CommandBehavior behavior) { this.InitializeForReader(); UtlDataReader target = new UtlDataReader(this, behavior); this._activeReader = new WeakReference(target, false); return(target); }
public override int ExecuteNonQuery() { using (UtlDataReader reader = this.ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult)) { while (reader.NextResult()) { } return(reader.RecordsAffected); } }
public override object ExecuteScalar() { this.InitializeForReader(); using (UtlDataReader reader = this.ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult)) { if (reader.Read()) { return(reader[0]); } } return(null); }
public void ClearCommands() { if (this._activeReader != null) { UtlDataReader target = null; try { target = this._activeReader.Target as UtlDataReader; } catch (InvalidOperationException) { } if (target != null) { target.Close(); } this._activeReader = null; } if (this.Statement != null) { this.Statement.Dispose(); } this.Statement = null; }