mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-24 18:25:04 +08:00
Revert "Improved performance of Count Hql queries" (#7563)
This commit is contained in:
committed by
Sébastien Ros
parent
abe040174d
commit
6f39308741
@@ -208,6 +208,7 @@ namespace Orchard.ContentManagement {
|
|||||||
public int Count() {
|
public int Count() {
|
||||||
ApplyHqlVersionOptionsRestrictions(_versionOptions);
|
ApplyHqlVersionOptionsRestrictions(_versionOptions);
|
||||||
var hql = ToHql(true);
|
var hql = ToHql(true);
|
||||||
|
hql = "select count(Id) from Orchard.ContentManagement.Records.ContentItemVersionRecord where Id in ( " + hql + " )";
|
||||||
return Convert.ToInt32(_session.CreateQuery(hql)
|
return Convert.ToInt32(_session.CreateQuery(hql)
|
||||||
.SetCacheable(true)
|
.SetCacheable(true)
|
||||||
.UniqueResult())
|
.UniqueResult())
|
||||||
@@ -218,7 +219,7 @@ namespace Orchard.ContentManagement {
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
if (count) {
|
if (count) {
|
||||||
sb.Append("select count(distinct civ.Id)").AppendLine();
|
sb.Append("select distinct civ.Id as Id").AppendLine();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sb.Append("select distinct civ.Id as Id");
|
sb.Append("select distinct civ.Id as Id");
|
||||||
|
|||||||
Reference in New Issue
Block a user