/// <inheritdoc cref="DbCommand.ExecuteDbDataReader(CommandBehavior)" /> protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) { QueryStart = DateTime.Now; var cn = Connection as AdoNetProfilerDbConnection; if (cn != null) { cn.TotalQueries++; } if (_profiler == null || !_profiler.IsEnabled) { return(WrappedCommand.ExecuteReader(behavior)); } _profiler.OnExecuteReaderStart(this); try { var sd = DateTime.Now; var dbReader = WrappedCommand.ExecuteReader(behavior); var dr = new AdoNetProfilerDbDataReader(dbReader, _profiler, sd); dr.Command = this; return(dr); } catch (Exception ex) { _profiler.OnCommandError(this, ex); throw; } }
/// <inheritdoc cref="DbCommand.ExecuteDbDataReader(CommandBehavior)" /> protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) { if (_profiler == null || !_profiler.IsEnabled) { return(WrappedCommand.ExecuteReader(behavior)); } _profiler.OnExecuteReaderStart(this); try { var dbReader = WrappedCommand.ExecuteReader(behavior); return(new AdoNetProfilerDbDataReader(dbReader, _profiler)); } catch (Exception ex) { _profiler.OnCommandError(this, ex); throw; } }