Browse Source

Update queryable.IntoTable

pull/33/head
sunkaixuan 2 years ago
parent
commit
af5f3ff188
  1. 1
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableExecuteSql.cs
  2. 23
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableExecuteSqlAsync.cs
  3. 6
      Src/Asp.Net/SqlSugar/Interface/IQueryable.cs

1
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableExecuteSql.cs

@ -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;

23
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableExecuteSqlAsync.cs

@ -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);
}
}
}

6
Src/Asp.Net/SqlSugar/Interface/IQueryable.cs

@ -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);

Loading…
Cancel
Save