开启默认sugar超时时间
This commit is contained in:
@@ -36,14 +36,14 @@ public static class ConfigureSqlSugarExtensions
|
|||||||
|
|
||||||
services.AddSqlSugar(connectConfigList, client =>
|
services.AddSqlSugar(connectConfigList, client =>
|
||||||
{
|
{
|
||||||
//connectConfigList.ForEach(config =>
|
connectConfigList.ForEach(config =>
|
||||||
//{
|
{
|
||||||
// var db = ((SqlSugarScope)client).GetConnectionScope((string)config.ConfigId);
|
var db = ((SqlSugarScope)client).GetConnectionScope((string)config.ConfigId);
|
||||||
|
|
||||||
// // 设置超时时间
|
// 设置超时时间
|
||||||
// db.Ado.CommandTimeOut = 30;
|
db.Ado.CommandTimeOut = 30;
|
||||||
// db.Aop.OnLogExecuted = (sql, pars) =>
|
//db.Aop.OnLogExecuted = (sql, pars) =>
|
||||||
// {
|
//{
|
||||||
// var oldColor = Console.ForegroundColor;
|
// var oldColor = Console.ForegroundColor;
|
||||||
// Console.ForegroundColor = ConsoleColor.Green;
|
// Console.ForegroundColor = ConsoleColor.Green;
|
||||||
// var finalSql = UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, sql, pars);
|
// var finalSql = UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, sql, pars);
|
||||||
@@ -55,12 +55,12 @@ public static class ConfigureSqlSugarExtensions
|
|||||||
// Log.Warning($"慢查询: {db.Ado.SqlExecutionTime.TotalMilliseconds}ms, SQL: " + finalSql);
|
// Log.Warning($"慢查询: {db.Ado.SqlExecutionTime.TotalMilliseconds}ms, SQL: " + finalSql);
|
||||||
// }
|
// }
|
||||||
// Console.WriteLine();
|
// Console.WriteLine();
|
||||||
// };
|
//};
|
||||||
// db.Aop.OnError = (ex) =>
|
//db.Aop.OnError = (ex) =>
|
||||||
// {
|
//{
|
||||||
// Log.Error(UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, ex.Sql, (SugarParameter[])ex.Parametres));
|
// Log.Error(UtilMethods.GetSqlString(db.CurrentConnectionConfig.DbType, ex.Sql, (SugarParameter[])ex.Parametres));
|
||||||
// };
|
//};
|
||||||
//});
|
});
|
||||||
});
|
});
|
||||||
services.AddConfigurableOptions<ConnectionStringsOptions>();
|
services.AddConfigurableOptions<ConnectionStringsOptions>();
|
||||||
services.AddConfigurableOptions<TenantOptions>();
|
services.AddConfigurableOptions<TenantOptions>();
|
||||||
|
|||||||
Reference in New Issue
Block a user