Add DropTable<T1-T4>

This commit is contained in:
sunkaixuan 2022-09-12 03:59:50 +08:00
parent c7816e7f08
commit 432c4a679c
2 changed files with 30 additions and 1 deletions

View File

@ -253,7 +253,32 @@ namespace SqlSugar
this.Context.Ado.ExecuteCommand(string.Format(this.DropTableSql, tableName));
return true;
}
public virtual bool DropTable<T>()
{
var tableName= this.Context.EntityMaintenance.GetTableName<T>();
return DropTable(tableName);
}
public virtual bool DropTable<T,T2>()
{
DropTable<T>();
DropTable<T2>();
return true;
}
public virtual bool DropTable<T, T2,T3>()
{
DropTable<T>();
DropTable<T2>();
DropTable<T3>();
return true;
}
public virtual bool DropTable<T, T2, T3,T4>()
{
DropTable<T>();
DropTable<T2>();
DropTable<T3>();
DropTable<T4>();
return true;
}
public virtual bool TruncateTable<T>()
{
this.Context.InitMappingInfo<T>();

View File

@ -32,6 +32,10 @@ namespace SqlSugar
bool CreateIndex(string tableName, string [] columnNames, bool isUnique=false);
bool CreateIndex(string tableName, string[] columnNames, string IndexName, bool isUnique = false);
bool DropTable(string tableName);
bool DropTable<T>();
bool DropTable<T,T2>();
bool DropTable<T, T2,T3>();
bool DropTable<T, T2, T3,T4>();
bool TruncateTable(string tableName);
bool TruncateTable<T>();
bool TruncateTable<T,T2>();