public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext) { string methodName = input.MethodBase.ReflectedType + "." + input.MethodBase.Name; if (!isLockEnabled) { logger.Debug("Ignored lock, method=" + methodName + ", SynRoot=" + input.MethodBase); return(getNext().Invoke(input, getNext)); } StopWatch stopWatch = new StopWatch(); logger.Debug("Waiting for Lock, method=" + methodName + ", SynRoot=" + input.MethodBase); IMethodReturn methodReturn = null; lock (input.MethodBase) { stopWatch.Stop(); logger.Debug("Got Lock, WaitedMs=" + stopWatch.ElapsedMs()); methodReturn = getNext().Invoke(input, getNext); } logger.Debug("Released Lock, method=" + methodName + ", SynRoot=" + input.MethodBase); return(methodReturn); }
protected virtual DataSet ExecuteDataSet(DbCommand dbCommand) { DataSet dataSet = null; StopWatch stopWatch = new StopWatch(); try { dbCommand.CommandTimeout = timeout; dataSet = database.ExecuteDataSet(dbCommand); Logger.Info("ExecuteDataSet, StoreProcedureName=" + dbCommand.CommandText + ", Params={" + GetParams(dbCommand) + "}, Dataset Summary=" + GetDataSetSummary(dataSet)); return(dataSet); } finally { stopWatch.End(); Logger.Info("ExecuteNonQuery Complete, elapsed=" + stopWatch.ElapsedMs()); } }
public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext) { string methodName = input.MethodBase.ReflectedType + "." + input.MethodBase.Name; StringBuilder param = new StringBuilder(); for (int i = 0; i < input.Arguments.Count; i++) { param.Append(input.Arguments.GetParameterInfo(i).Name + "=" + input.Arguments[i] + ","); } logger.Debug("Start Invoke, method=" + methodName + ", params=" + param); StopWatch stopWatch = new StopWatch(); IMethodReturn methodReturn = getNext().Invoke(input, getNext); stopWatch.Stop(); logger.Debug("End Invoke, method=" + methodName + ", ElapsedMs=" + stopWatch.ElapsedMs()); return(methodReturn); }
protected virtual T ExecuteScalar <T>(DbCommand dbCommand) { object result = null; StopWatch stopWatch = new StopWatch(); try { dbCommand.CommandTimeout = timeout; Logger.Info("ExecuteScalar, StoreProcedureName=" + dbCommand.CommandText + ", Params={" + GetParams(dbCommand) + "}"); result = database.ExecuteScalar(dbCommand); return(ConversionUtil.To <T>(result)); } finally { stopWatch.End(); Logger.Info("ExecuteScalar Complete, result=" + ConversionUtil.To <string>(result) + " elapsed=" + stopWatch.ElapsedMs()); } }
protected virtual int ExecuteNonQuery(DbCommand dbCommand) { int result = 0; StopWatch stopWatch = new StopWatch(); try { dbCommand.CommandTimeout = timeout; Logger.Info("ExecuteNonQuery, StoreProcedureName=" + dbCommand.CommandText + ", Params={" + GetParams(dbCommand) + "}"); result = database.ExecuteNonQuery(dbCommand); return(result); } finally { stopWatch.End(); Logger.Info("ExecuteNonQuery Complete, result=" + result + ", elapsed=" + stopWatch.ElapsedMs()); } }
protected virtual int ExecuteBatchSPCall(DbCommand dbCommand, DataSet dataSet) { int result = 0; StopWatch stopWatch = new StopWatch(); try { dbCommand.CommandTimeout = timeout; Logger.Info("ExecuteBatchUpdate, StoreProcedureName=" + dbCommand.CommandText); result = database.UpdateDataSet(dataSet, BATCHTABLENAME, dbCommand, null, null, UpdateBehavior.Standard); return(result); } finally { stopWatch.End(); Logger.Info("ExecuteBatchUpdate Complete, result=" + result + " ,elapsed=" + stopWatch.ElapsedMs() + " ms"); } }
public void BuildUp(object obj) { StopWatch stopWatch = new StopWatch(); container.BuildUp(obj.GetType(), obj); stopWatch.Stop(); logger.Debug("BuildUp object, type=" + obj.GetType() + ", ElapsedTime=" + stopWatch.ElapsedMs()); }