Code synchronization .NET

This commit is contained in:
sunkaixuna
2021-12-07 22:15:33 +08:00
parent 5371bb31eb
commit 9c381a7e3f
2 changed files with 10 additions and 0 deletions

View File

@@ -184,6 +184,15 @@ namespace SqlSugar
this.Context.Ado.ExecuteCommand(sql);
return true;
}
public bool AddPrimaryKeys(string tableName, string[] columnNames,string pkName)
{
tableName = this.SqlBuilder.GetTranslationTableName(tableName);
var columnName = string.Join(",", columnNames);
//var pkName = string.Format("PK_{0}_{1}", this.SqlBuilder.GetNoTranslationColumnName(tableName), columnName.Replace(",", "_"));
string sql = string.Format(this.AddPrimaryKeySql, tableName, pkName, columnName);
this.Context.Ado.ExecuteCommand(sql);
return true;
}
public virtual bool AddColumn(string tableName, DbColumnInfo columnInfo)
{
tableName = this.SqlBuilder.GetTranslationTableName(tableName);

View File

@@ -37,6 +37,7 @@ namespace SqlSugar
bool UpdateColumn(string tableName, DbColumnInfo column);
bool AddPrimaryKey(string tableName,string columnName);
bool AddPrimaryKeys(string tableName, string [] columnNames);
bool AddPrimaryKeys(string tableName, string[] columnNames,string pkName);
bool DropConstraint(string tableName, string constraintName);
bool BackupDataBase(string databaseName,string fullFileName);
bool BackupTable(string oldTableName, string newTableName, int maxBackupDataRows = int.MaxValue);