/// <inheritdoc cref="DbCommand.ExecuteNonQuery()" /> public override int ExecuteNonQuery() { if (_profiler == null || !_profiler.IsEnabled) { return(WrappedCommand.ExecuteNonQuery()); } _profiler.OnExecuteNonQueryStart(this); var result = default(int?); try { result = WrappedCommand.ExecuteNonQuery(); return(result.Value); } catch (Exception ex) { _profiler.OnCommandError(this, ex); throw; } finally { _profiler.OnExecuteNonQueryFinish(this, result ?? 0); } }
/// <inheritdoc cref="DbCommand.ExecuteNonQuery()" /> public override int ExecuteNonQuery() { QueryStart = DateTime.Now; var cn = Connection as AdoNetProfilerDbConnection; if (cn != null) { cn.TotalQueries++; } if (_profiler == null || !_profiler.IsEnabled) { return(WrappedCommand.ExecuteNonQuery()); } _profiler.OnExecuteNonQueryStart(this); var result = default(int?); try { result = WrappedCommand.ExecuteNonQuery(); return(result.Value); } catch (Exception ex) { _profiler.OnCommandError(this, ex); throw; } finally { _profiler.OnExecuteNonQueryFinish(this, result ?? 0); } }