0

我正在尝试通过分类法获取一些内容,这是该内容的一部分/这就是我所拥有的:

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 做到了这一点,但我想用表达式做同样的事情。问题是最后一点代码没有返回任何记录。

有什么帮助吗?

4

1 回答 1

0

我发现了问题:

contentItems = _cm
.Query<GenericContentPart, GenericContentRecord>()
.Join<TermsPartRecord>().ForPart<TermsPart>().List()
.Where(l => !listOfTermsIds.Except(l.Terms.Select(t => t.TermRecord.Id).ToList()).Any());

谢谢。

于 2015-07-22T15:00:47.167 回答