调整主库SqlSugarScope对IUser的取值方式

usertest
zhangxiaofeng 3 months ago
parent 20fcfca0e2
commit db28488261

@ -85,8 +85,8 @@ public static class SqlsugarInstall
// } // }
// }); // });
//} //}
var httpContextAccessor = services.GetService<IHttpContextAccessor>(); //var httpContextAccessor = services.GetService<IHttpContextAccessor>();
var user = services.GetService<IUser>(); //var user = services.GetService<IUser>();
//if (user.IsNullOrEmpty()) //if (user.IsNullOrEmpty())
//{ //{
// user = new AspNetUser(httpContextAccessor) // user = new AspNetUser(httpContextAccessor)
@ -110,7 +110,7 @@ public static class SqlsugarInstall
var dbProvider = db.GetConnectionScope((string)c.ConfigId); var dbProvider = db.GetConnectionScope((string)c.ConfigId);
// var user = services.GetService<IUser>(); var user = services.GetService<IUser>();
//单例参数配置,所有上下文生效 //单例参数配置,所有上下文生效
dbProvider.Ado.CommandTimeOut = 30; dbProvider.Ado.CommandTimeOut = 30;
dbProvider.Aop.OnLogExecuting = (sql, pars) => dbProvider.Aop.OnLogExecuting = (sql, pars) =>

@ -33,7 +33,11 @@ public class AspNetUser : IUser
{ {
get get
{ {
return GetClaimsIdentity().ToList(); if (_claims == null || _claims.Count == 0)
{
_claims = GetClaimsIdentity().ToList();
}
return _claims;
} }
} }

Loading…
Cancel
Save