|
@@ -210,11 +210,11 @@ namespace Hotline.Repository.SqlSugar.Extensions
|
|
db.Aop.OnLogExecuting = (sql, pars) =>
|
|
db.Aop.OnLogExecuting = (sql, pars) =>
|
|
{
|
|
{
|
|
|
|
|
|
- Log.Warning($"sql参数:{JsonSerializer.Serialize(db.Ado.SqlStackTrace, new JsonSerializerOptions { Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.CjkUnifiedIdeographs) })}");
|
|
|
|
|
|
+ //Log.Warning($"sql参数:{JsonSerializer.Serialize(db.Ado.SqlStackTrace, new JsonSerializerOptions { Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.CjkUnifiedIdeographs) })}");
|
|
|
|
|
|
|
|
|
|
- //获取原生SQL推荐 5.1.4.63 性能OK
|
|
|
|
- Log.Information(UtilMethods.GetNativeSql(sql, pars));
|
|
|
|
|
|
+ ////获取原生SQL推荐 5.1.4.63 性能OK
|
|
|
|
+ //Log.Information(UtilMethods.GetNativeSql(sql, pars));
|
|
|
|
|
|
//Log.Information("Sql: {0}", sql);
|
|
//Log.Information("Sql: {0}", sql);
|
|
//Log.Information("SqlParameters: {0}", string.Join(',', pars.Select(d => d.Value)));
|
|
//Log.Information("SqlParameters: {0}", string.Join(',', pars.Select(d => d.Value)));
|
|
@@ -256,27 +256,6 @@ namespace Hotline.Repository.SqlSugar.Extensions
|
|
Log.Warning(UtilMethods.GetNativeSql(sql, p));
|
|
Log.Warning(UtilMethods.GetNativeSql(sql, p));
|
|
Log.Warning("slow query totalSeconds: {sec}", db.Ado.SqlExecutionTime.TotalSeconds);
|
|
Log.Warning("slow query totalSeconds: {sec}", db.Ado.SqlExecutionTime.TotalSeconds);
|
|
}
|
|
}
|
|
- //相当于EF的 PrintToMiniProfiler
|
|
|
|
- if (sql.StartsWith("UPDATE", StringComparison.OrdinalIgnoreCase) &&
|
|
|
|
- sql.Contains("\"order\"", StringComparison.OrdinalIgnoreCase) &&
|
|
|
|
- sql.Contains("CallId"))
|
|
|
|
- {
|
|
|
|
- // 正则表达式匹配字段 CallId 的新值
|
|
|
|
- var regex = new Regex(@"2024.*CTI", RegexOptions.IgnoreCase);
|
|
|
|
- var match = regex.Match(sql);
|
|
|
|
-
|
|
|
|
- if (match.Success)
|
|
|
|
- {
|
|
|
|
- StackTrace stackTrace = new StackTrace(true);
|
|
|
|
- var frames = stackTrace.GetFrames();
|
|
|
|
- var newCallIdValue = match.Groups[0].Value;
|
|
|
|
- var fileName = db.Ado.SqlStackTrace.FirstFileName;
|
|
|
|
- var fileLine = db.Ado.SqlStackTrace.FirstLine;
|
|
|
|
- var FirstMethodName = db.Ado.SqlStackTrace.FirstMethodName;
|
|
|
|
- Log.Warning("update Order.CallId 被修改 ==> fileName: {fileName}, fileLine: {fileLine}, FirstMethodName: {FirstMethodName}",
|
|
|
|
- fileName, fileLine, FirstMethodName);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
};
|
|
};
|
|
|
|
|
|
db.Aop.DataExecuting = (oldValue, entityInfo) =>
|
|
db.Aop.DataExecuting = (oldValue, entityInfo) =>
|