mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing tags queries
QueryOver doesn't support the Any() operator on a relationship. The current Linq implementation supports it but is using Hql, so it can't be reused. The QueryOver uses Criteria. The old NHibernate.Linq implementation is not compatible with NH3. Though it was using the Criteria API. --HG-- branch : 1.x
This commit is contained in:
@@ -131,9 +131,9 @@ namespace Orchard.Tags.Services {
|
||||
|
||||
public IEnumerable<IContent> GetTaggedContentItems(int tagId, int skip, int take, VersionOptions options) {
|
||||
return _orchardServices.ContentManager
|
||||
.Query<TagsPart, TagsPartRecord>()
|
||||
.Where(tpr => tpr.Tags.Any(tr => tr.TagRecord.Id == tagId))
|
||||
.Join<CommonPartRecord>().OrderByDescending(x => x.CreatedUtc)
|
||||
.HqlQuery<TagsPart>()
|
||||
.Where(tpr => tpr.ContentPartRecord<TagsPartRecord>().Property("Tags", "tags"), x => x.Eq("TagRecord.Id", tagId))
|
||||
.OrderBy(alias => alias.ContentPartRecord<CommonPartRecord>(), x => x.Desc("CreatedUtc"))
|
||||
.Slice(skip, take);
|
||||
}
|
||||
|
||||
@@ -143,8 +143,8 @@ namespace Orchard.Tags.Services {
|
||||
|
||||
public int GetTaggedContentItemCount(int tagId, VersionOptions options) {
|
||||
return _orchardServices.ContentManager
|
||||
.Query<TagsPart, TagsPartRecord>()
|
||||
.Where(tpr => tpr.Tags.Any(tr => tr.TagRecord.Id == tagId))
|
||||
.HqlQuery<TagsPart>()
|
||||
.Where(tpr => tpr.ContentPartRecord<TagsPartRecord>().Property("Tags", "tags"), x => x.Eq("TagRecord.Id", tagId))
|
||||
.Count();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user