Add itenant api

This commit is contained in:
sunkaixuan
2022-06-15 18:49:05 +08:00
parent b8ba98ff9f
commit 7e7f445a6f
3 changed files with 66 additions and 0 deletions

View File

@@ -24,6 +24,13 @@ namespace SqlSugar
SqlSugarScopeProvider GetConnectionScope(dynamic configId);
SqlSugarProvider GetConnectionWithAttr<T>();
SqlSugarScopeProvider GetConnectionScopeWithAttr<T>();
ISugarQueryable<T> QueryableWithAttr<T>();
IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new();
IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new();
IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new();
IUpdateable<T> UpdateableWithAttr<T>(List<T> updateObjs) where T : class, new();
IDeleteable<T> DeleteableWithAttr<T>(T deleteObjs) where T : class, new();
IDeleteable<T> DeleteableWithAttr<T>(List<T> deleteObjs) where T : class, new();
bool IsAnyConnection(dynamic configId);
void Close();

View File

@@ -1243,5 +1243,36 @@ namespace SqlSugar
this.CurrentConnectionConfig = Tenant.ConnectionConfig;
}
#endregion
#region Tenant Crud
public ISugarQueryable<T> QueryableWithAttr<T>()
{
return this.GetConnectionWithAttr<T>().Queryable<T>();
}
public IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new()
{
return this.GetConnectionWithAttr<T>().Insertable(insertObj);
}
public IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new()
{
return this.GetConnectionWithAttr<T>().Insertable(insertObjs);
}
public IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new()
{
return this.GetConnectionWithAttr<T>().Updateable(updateObj);
}
public IUpdateable<T> UpdateableWithAttr<T>(List<T> updateObjs) where T : class, new()
{
return this.GetConnectionWithAttr<T>().Updateable(updateObjs);
}
public IDeleteable<T> DeleteableWithAttr<T>(T deleteObject) where T : class, new()
{
return this.GetConnectionWithAttr<T>().Deleteable(deleteObject);
}
public IDeleteable<T> DeleteableWithAttr<T>(List<T> deleteObjects) where T : class, new()
{
return this.GetConnectionWithAttr<T>().Deleteable(deleteObjects);
}
#endregion
}
}

View File

@@ -695,5 +695,33 @@ namespace SqlSugar
{
return ScopedContext.ThenMapperAsync(list, action);
}
public ISugarQueryable<T> QueryableWithAttr<T>()
{
return ScopedContext.QueryableWithAttr<T>();
}
public IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new()
{
return ScopedContext.InsertableWithAttr<T>(insertObj);
}
public IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new()
{
return ScopedContext.InsertableWithAttr<T>(insertObjs);
}
public IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new()
{
return ScopedContext.UpdateableWithAttr<T>(updateObj);
}
public IUpdateable<T> UpdateableWithAttr<T>(List<T> updateObjs) where T : class, new()
{
return ScopedContext.UpdateableWithAttr<T>(updateObjs);
}
public IDeleteable<T> DeleteableWithAttr<T>(T deleteObj) where T : class, new()
{
return ScopedContext.DeleteableWithAttr<T>(deleteObj);
}
public IDeleteable<T> DeleteableWithAttr<T>(List<T> deleteObjs) where T : class, new()
{
return ScopedContext.DeleteableWithAttr<T>(deleteObjs);
}
}
}