mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-17 10:41:56 +08:00
-
This commit is contained in:
parent
5cfb1efd8e
commit
35fb5d9633
@ -452,12 +452,19 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
InitMapping();
|
InitMapping();
|
||||||
QueryBuilder.IsCount = true;
|
QueryBuilder.IsCount = true;
|
||||||
|
int result = 0;
|
||||||
int reval = GetCount();
|
if (IsCache)
|
||||||
|
{
|
||||||
|
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
|
||||||
|
result = CacheSchemeMain.GetOrCreate<int>(cacheService, this.QueryBuilder, () => { return GetCount(); }, CacheTime, this.Context);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result= GetCount();
|
||||||
|
}
|
||||||
RestoreMapping();
|
RestoreMapping();
|
||||||
QueryBuilder.IsCount = false;
|
QueryBuilder.IsCount = false;
|
||||||
return reval;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual int Count(Expression<Func<T, bool>> expression)
|
public virtual int Count(Expression<Func<T, bool>> expression)
|
||||||
|
Loading…
Reference in New Issue
Block a user