簡體   English   中英

果園通過分類法獲取內容

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM