mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
ISqlSugarClient Add AsTenant
This commit is contained in:
parent
659ab5f179
commit
094c75ed2f
@ -1168,5 +1168,14 @@ namespace SqlSugar
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region AsTenant
|
||||
public ITenant AsTenant()
|
||||
{
|
||||
Check.Exception(true,ErrorMessage.GetThrowMessage("Child objects do not support tenant methods, var childDb= Db.GetConnection(confid) ,Db is master ", "Db子对象不支持租户方法,请使用主对象,例如:var childDb= Db.GetConnection(confid) Db是主对象,childDb是子对象 "));
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,8 @@ namespace SqlSugar
|
||||
void InitMappingInfo(Type type);
|
||||
void InitMappingInfo<T>();
|
||||
void Open();
|
||||
void Close();
|
||||
void Close();
|
||||
ITenant AsTenant();
|
||||
#endregion
|
||||
|
||||
#region Insertable
|
||||
|
@ -576,6 +576,11 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region TenantManager
|
||||
public ITenant AsTenant()
|
||||
{
|
||||
var tenant= this as ITenant;
|
||||
return tenant;
|
||||
}
|
||||
public SqlSguarTransaction UseTran()
|
||||
{
|
||||
return new SqlSguarTransaction(this);
|
||||
|
@ -65,6 +65,10 @@ namespace SqlSugar
|
||||
|
||||
public SugarCacheProvider DataCache => ScopedContext.DataCache;
|
||||
|
||||
public ITenant AsTenant()
|
||||
{
|
||||
return ScopedContext.AsTenant();
|
||||
}
|
||||
public void AddConnection(ConnectionConfig connection)
|
||||
{
|
||||
ScopedContext.AddConnection(connection);
|
||||
|
Loading…
Reference in New Issue
Block a user