diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index a072ed9f1..0e9de6cac 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -880,6 +880,15 @@ namespace SqlSugar else return null; } + public async virtual Task ToArrayAsync() + { + + var result =await this.ToListAsync(); + if (result.HasValue()) + return result.ToArray(); + else + return null; + } public virtual string ToJson() { if (IsCache) diff --git a/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs b/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs index 4a5fd9231..15bd03b15 100644 --- a/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs +++ b/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs @@ -133,6 +133,7 @@ namespace SqlSugar Task>> ToDictionaryListAsync(); T[] ToArray(); + Task ToArrayAsync(); Task> ToListAsync(); string ToJson();