Browse Source

Add ToArrayAsync

pull/3/head
sunkaixuna 3 years ago
parent
commit
6506aa7de2
  1. 9
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs
  2. 1
      Src/Asp.Net/SqlSugar/Interface/IQueryable.cs

9
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -880,6 +880,15 @@ namespace SqlSugar
else else
return null; return null;
} }
public async virtual Task<T[]> ToArrayAsync()
{
var result =await this.ToListAsync();
if (result.HasValue())
return result.ToArray();
else
return null;
}
public virtual string ToJson() public virtual string ToJson()
{ {
if (IsCache) if (IsCache)

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

@ -133,6 +133,7 @@ namespace SqlSugar
Task<List<Dictionary<string, object>>> ToDictionaryListAsync(); Task<List<Dictionary<string, object>>> ToDictionaryListAsync();
T[] ToArray(); T[] ToArray();
Task<T[]> ToArrayAsync();
Task<List<T>> ToListAsync(); Task<List<T>> ToListAsync();
string ToJson(); string ToJson();

Loading…
Cancel
Save