mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 02:14:53 +08:00
ISqlSugarClient Add AsTenant
This commit is contained in:
@@ -1168,5 +1168,14 @@ namespace SqlSugar
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endregion
|
#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(Type type);
|
||||||
void InitMappingInfo<T>();
|
void InitMappingInfo<T>();
|
||||||
void Open();
|
void Open();
|
||||||
void Close();
|
void Close();
|
||||||
|
ITenant AsTenant();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Insertable
|
#region Insertable
|
||||||
|
|||||||
@@ -576,6 +576,11 @@ namespace SqlSugar
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region TenantManager
|
#region TenantManager
|
||||||
|
public ITenant AsTenant()
|
||||||
|
{
|
||||||
|
var tenant= this as ITenant;
|
||||||
|
return tenant;
|
||||||
|
}
|
||||||
public SqlSguarTransaction UseTran()
|
public SqlSguarTransaction UseTran()
|
||||||
{
|
{
|
||||||
return new SqlSguarTransaction(this);
|
return new SqlSguarTransaction(this);
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public SugarCacheProvider DataCache => ScopedContext.DataCache;
|
public SugarCacheProvider DataCache => ScopedContext.DataCache;
|
||||||
|
|
||||||
|
public ITenant AsTenant()
|
||||||
|
{
|
||||||
|
return ScopedContext.AsTenant();
|
||||||
|
}
|
||||||
public void AddConnection(ConnectionConfig connection)
|
public void AddConnection(ConnectionConfig connection)
|
||||||
{
|
{
|
||||||
ScopedContext.AddConnection(connection);
|
ScopedContext.AddConnection(connection);
|
||||||
|
|||||||
Reference in New Issue
Block a user