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