Update queryable.IntoTable

This commit is contained in:
sunkaixuan
2023-05-14 12:19:20 +08:00
parent 2be7778141
commit af5f3ff188
3 changed files with 29 additions and 1 deletions

View File

@@ -756,7 +756,6 @@ namespace SqlSugar
var name = this.SqlBuilder.GetTranslationTableName(entityInfo.DbTableName);
return IntoTable(TableEntityType, name);
}
public int IntoTable(Type TableEntityType,string TableName)
{
KeyValuePair<string, List<SugarParameter>> sqlInfo;

View File

@@ -674,5 +674,28 @@ ParameterT parameter)
var list = await this.ToListAsync();
return GetChildList(parentIdExpression, pk, list, primaryKeyValue, isContainOneself);
}
public Task<int> IntoTableAsync<TableEntityType>(CancellationToken cancellationToken = default)
{
return IntoTableAsync(typeof(TableEntityType));
}
public Task<int> IntoTableAsync<TableEntityType>(string TableName, CancellationToken cancellationToken = default)
{
return IntoTableAsync(typeof(TableEntityType), TableName, cancellationToken );
}
public Task<int> IntoTableAsync(Type TableEntityType, CancellationToken cancellationToken = default)
{
var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(TableEntityType);
var name = this.SqlBuilder.GetTranslationTableName(entityInfo.DbTableName);
return IntoTableAsync(TableEntityType, name);
}
public async Task<int> IntoTableAsync(Type TableEntityType, string TableName, CancellationToken cancellationToken = default)
{
KeyValuePair<string, List<SugarParameter>> sqlInfo;
string sql;
OutIntoTableSql(TableName, out sqlInfo, out sql);
return await this.Context.Ado.ExecuteCommandAsync(sql, sqlInfo.Value);
}
}
}

View File

@@ -182,6 +182,12 @@ namespace SqlSugar
int IntoTable(Type TableEntityType);
int IntoTable<TableEntityType>(string tableName);
int IntoTable(Type TableEntityType,string tableName);
Task<int> IntoTableAsync<TableEntityType>(CancellationToken cancellationToken = default);
Task<int> IntoTableAsync(Type TableEntityType, CancellationToken cancellationToken = default);
Task<int> IntoTableAsync<TableEntityType>(string tableName, CancellationToken cancellationToken = default);
Task<int> IntoTableAsync(Type TableEntityType, string tableName, CancellationToken cancellationToken = default);
//bool IntoTable(Type TableEntityType, params string[] columnNameList);
//bool IntoTable<TableEntityType>(params string[] columnNameList);
List<T> SetContext<ParameterT>(Expression<Func<T, bool>> whereExpression, ParameterT parameter);