mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Update ScopedClient
This commit is contained in:
@@ -10,13 +10,15 @@ namespace SqlSugar
|
||||
public class ScopedClient : ISqlSugarClient, ITenant
|
||||
{
|
||||
private SqlSugarClient db;
|
||||
private Action<SqlSugarClient> configAction;
|
||||
private ScopedClient()
|
||||
{
|
||||
|
||||
}
|
||||
public ScopedClient(SqlSugarClient context)
|
||||
public ScopedClient(SqlSugarClient context,Action<SqlSugarClient> configAction)
|
||||
{
|
||||
this.db = context;
|
||||
this.configAction = configAction;
|
||||
}
|
||||
public SqlSugarClient ScopedContext
|
||||
{
|
||||
@@ -28,6 +30,10 @@ namespace SqlSugar
|
||||
{
|
||||
CallContextAsync<SqlSugarClient>.SetData(key, new SqlSugarClient(db._allConfigs));
|
||||
result = CallContextAsync<SqlSugarClient>.GetData(key);
|
||||
if (this.configAction != null)
|
||||
{
|
||||
this.configAction(result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user