private void CommandExecuting <T>(ExecutingMethod <T> executingMethod, System.Data.Common.DbCommand command, DbCommandInterceptionContext <T> interceptionContext) { Stopwatch sw = Stopwatch.StartNew(); executingMethod.Invoke(command, interceptionContext); sw.Stop(); if (interceptionContext.Exception != null) { Logger.Error(String.Format("Error executing command: {0}", command.CommandText), interceptionContext.Exception); } else { Logger.Info(String.Format("{0} took {1}", command.CommandText, sw.Elapsed)); } }
private void CommandExecuting <T>(ExecutingMethod <T> executingMethod, System.Data.Common.DbCommand command, DbCommandInterceptionContext <T> interceptionContext) { Stopwatch sw = Stopwatch.StartNew(); executingMethod.Invoke(command, interceptionContext); sw.Stop(); if (interceptionContext.Exception != null) { _logger.error(interceptionContext.Exception, String.Format("Erro ao executar o comando: {0}", command.CommandText)); } else { _logger.information(String.Format("{0} took {1}", command.CommandText, sw.Elapsed.ToString())); } }