Optimized code

This commit is contained in:
sunkaixuan 2024-02-24 16:14:44 +08:00
parent 084562c290
commit e20bae24d7
2 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ namespace SqlSugar
}
public virtual bool Any()
{
return this.Select("1").ToList().Count() > 0;
return this.Take(1).Select("1").ToList().Count() > 0;
}
public virtual List<TResult> ToList<TResult>(Expression<Func<T, TResult>> expression)

View File

@ -131,7 +131,7 @@ namespace SqlSugar
public async Task<bool> AnyAsync()
{
return await this.CountAsync() > 0;
return (await this.Take(1).Select("1").ToListAsync()).Count() > 0; ;
}
public Task<int> CountAsync(CancellationToken token)