mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 23:13:42 +08:00
Optimized code
This commit is contained in:
parent
084562c290
commit
e20bae24d7
@ -93,7 +93,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public virtual bool Any()
|
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)
|
public virtual List<TResult> ToList<TResult>(Expression<Func<T, TResult>> expression)
|
||||||
|
@ -131,7 +131,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public async Task<bool> AnyAsync()
|
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)
|
public Task<int> CountAsync(CancellationToken token)
|
||||||
|
Loading…
Reference in New Issue
Block a user