[英]Orchard get content by taxonomy
我正在尝试通过分类法获得一些内容,这些内容是该内容的一部分/这是我所拥有的:
var taxonomyTerms = _taxonomyService.GetTerms(taxonomy.Id).Where(t => termsToSearch.Contains(t.Name)).ToList();
var listOfTermsIds= taxonomyTerms.Select(x => x.Id).ToList();
//works well until here, I have my list of terms ids
var originalContentItems = _cm
.Query<GenericContentPart, GenericContentRecord>()
.Join<TermsPartRecord>().Where(l => !l.Terms.Select(t => t.TermRecord.Id).Except(listOfTermsIds).Any()).List();
//this returns no records
我已经设法用foreach做到了,但是我想用表达式做同样的事情。 问题是最后的代码不会返回任何记录。
有什么帮助吗?
我发现了问题:
contentItems = _cm
.Query<GenericContentPart, GenericContentRecord>()
.Join<TermsPartRecord>().ForPart<TermsPart>().List()
.Where(l => !listOfTermsIds.Except(l.Terms.Select(t => t.TermRecord.Id).ToList()).Any());
谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.