This commit is contained in:
2024-04-11 17:31:32 +08:00
parent f6eaa2f481
commit 4fbc6c0267
200 changed files with 1252 additions and 1860 deletions

View File

@@ -73,17 +73,17 @@ where TEntity : class, new()
base.Context.Ado.CommandTimeOut = 30;
base.Context.Aop.OnLogExecuted = (sql, pars) =>
{
var oldColor = Console.ForegroundColor;
// var oldColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Green;
var finalSql = UtilMethods.GetSqlString(Context.CurrentConnectionConfig.DbType, sql, pars);
Console.WriteLine($"【{DateTime.Now.ToString("HH:mm:ss.fff")}——SQL执行完成】{Context.Ado.SqlExecutionTime.TotalMilliseconds} ms");
Console.WriteLine(finalSql);
Console.ForegroundColor = oldColor;
// Console.WriteLine($"【{DateTime.Now.ToString("HH:mm:ss.fff")}——SQL执行完成】{Context.Ado.SqlExecutionTime.TotalMilliseconds} ms");
// Console.WriteLine(finalSql);
// Console.ForegroundColor = oldColor;
if (Context.Ado.SqlExecutionTime.TotalMilliseconds > 3000)
{
Log.Warning($"慢查询: {Context.Ado.SqlExecutionTime.TotalMilliseconds}ms, SQL: " + finalSql);
}
Console.WriteLine();
// Console.WriteLine();
//App.PrintToMiniProfiler("SqlSugar", "Info", sql + "\r\n" + base.Context.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
};
base.Context.Aop.OnError = (ex) =>