Пример #1
0
 /// <summary>
 /// 记录sql
 /// </summary>
 /// <param name="customerTraceInfo"></param>
 private static void OnCustomerTraceConnection(CustomerTraceInfo customerTraceInfo)
 {
     try
     {
         string sql = Environment.NewLine + "#####################################################" + Environment.NewLine + customerTraceInfo.SqlText;
         try
         {
             sql = customerTraceInfo.CustomerParams.Aggregate(customerTraceInfo.SqlText,
                                                              (current, item) => current.Replace(item.Key, item.Value.Value.ToString()));
         }
         catch (Exception)
         {
             //ignore
         }
         sql += Environment.NewLine;
         foreach (var detail in customerTraceInfo.RunTimeList)
         {
             var sencond = (int)detail.Duration.TotalSeconds;
             var time    = sencond + "秒";
             if (sencond < 1)
             {
                 time = detail.Duration.TotalMilliseconds + "豪秒";
             }
             sql += $"Server:{detail.Server},DB名称:{detail.DbName}, 执行时间:{time}" + Environment.NewLine + "#####################################################" + Environment.NewLine;
             LogHelper.Info("SQL:", sql);
         }
     }
     catch (Exception)
     {
         //ignore
     }
 }
Пример #2
0
 private static void OnCustomerTraceConnection(CustomerTraceInfo customerTraceInfo)
 {
     try
     {
         string sql = customerTraceInfo.CustomerParams.Aggregate(customerTraceInfo.SqlText,
                                                                 (current, item) => current.Replace(item.Key, item.Value.Value.ToString()));
         Debug.Write(sql + Environment.NewLine);
     }
     catch (Exception)
     {
         //ignore
     }
 }
Пример #3
0
 /// <summary>
 /// 显示sql
 /// </summary>
 /// <param name="customerTraceInfo"></param>
 protected void OnCustomerTraceConnection(CustomerTraceInfo customerTraceInfo)
 {
     try
     {
         string sql = customerTraceInfo.CustomerParams.Aggregate(customerTraceInfo.SqlText,
                                                                 (current, item) => current.Replace(item.Key, item.Value.Value.ToString()));
         Trace.Write(sql);
     }
     catch (Exception)
     {
         //ignore
     }
 }
Пример #4
0
 private static void OnCustomerTraceConnection(CustomerTraceInfo customerTraceInfo)
 {
     try
     {
         string sql = customerTraceInfo.CustomerParams.Aggregate(customerTraceInfo.SqlText,
                                                                 (current, item) => current.Replace(item.Key, item.Value.Value.ToString()));
         Debug.Write(sql + Environment.NewLine);
         foreach (var detail in customerTraceInfo.RunTimeList)
         {
             Debug.Write($"Server:{detail.Server},DB名称:{detail.DbName}, 执行时间:{detail.Duration.TotalSeconds}秒");
             Debug.Write(Environment.NewLine);
         }
     }
     catch (Exception)
     {
         //ignore
     }
 }
Пример #5
0
 private static void OnLogTrace(CustomerTraceInfo obj)
 {
 }