Browse Source

Adding method overload

pull/23/head
sunkaixuan 2 years ago
parent
commit
a82c1a9694
  1. 26
      Src/Asp.Net/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs
  2. 3
      Src/Asp.Net/SqlSugar/Interface/IDbMaintenance.cs

26
Src/Asp.Net/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs

@ -261,6 +261,15 @@ namespace SqlSugar
}
return true;
}
public virtual bool DropTable(Type[] tableEnittyTypes)
{
foreach (var item in tableEnittyTypes)
{
var tableName = this.Context.EntityMaintenance.GetTableName(item);
DropTable(tableName);
}
return true;
}
public virtual bool DropTable<T>()
{
var tableName= this.Context.EntityMaintenance.GetTableName<T>();
@ -342,6 +351,23 @@ namespace SqlSugar
this.Context.Ado.ExecuteCommand(string.Format(this.TruncateTableSql, tableName));
return true;
}
public bool TruncateTable(params string[] tableNames)
{
foreach (var item in tableNames)
{
TruncateTable(item);
}
return true;
}
public bool TruncateTable(params Type[] tableEnittyTypes)
{
foreach (var item in tableEnittyTypes)
{
var name = this.Context.EntityMaintenance.GetTableName(item);
TruncateTable(name);
}
return true;
}
public virtual bool BackupDataBase(string databaseName, string fullFileName)
{
var directory = FileHelper.GetDirectoryFromFilePath(fullFileName);

3
Src/Asp.Net/SqlSugar/Interface/IDbMaintenance.cs

@ -33,11 +33,14 @@ namespace SqlSugar
bool CreateIndex(string tableName, string[] columnNames, string IndexName, bool isUnique = false);
bool DropTable(string tableName);
bool DropTable(params string[] tableName);
bool DropTable(params Type[] tableEntityTypes);
bool DropTable<T>();
bool DropTable<T,T2>();
bool DropTable<T, T2,T3>();
bool DropTable<T, T2, T3,T4>();
bool TruncateTable(string tableName);
bool TruncateTable(params string[] tableName);
bool TruncateTable(params Type[] tableEntityType);
bool TruncateTable<T>();
bool TruncateTable<T,T2>();
bool TruncateTable<T, T2, T3>();

Loading…
Cancel
Save