Fixing Count() queries

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-08-08 14:36:57 -07:00
parent 4a9ecae611
commit 7337c0d676

View File

@@ -154,11 +154,14 @@ namespace Orchard.ContentManagement {
int Count() {
var queryOver = BindItemVersionQueryOver();
queryOver.ClearOrders();
queryOver.ApplyVersionOptionsRestrictions(_versionOptions);
// clone the query so that it doesn't affect the current one
var countQuery = queryOver.Clone();
countQuery.ClearOrders();
return queryOver.Select(Projections.RowCount()).FutureValue<int>().Value;
countQuery.ApplyVersionOptionsRestrictions(_versionOptions);
return countQuery.Select(Projections.RowCount()).FutureValue<int>().Value;
}
IContentQuery<TPart> IContentQuery.ForPart<TPart>() {