English 中文(简体)
地点核心轴心 Axes. 其中——包容性?
原标题:Sitecore Axes.IsDescendantOf / Axes.IsAncestorOf - Inclusive?

是否有理由或我所遗漏的,有<条码>真实性,有<条码>。

var test =
Sitecore.Context.Database.GetItem("{862B466A-079B-40E7-8661-FC064EC28574}");  
Response.Write(test.Axes.IsAncestorOf(test));  
Response.Write(test.Axes.IsDes(test));

//True
//True

。 在中,下面是两个例子,我需要找到一个多层新闻领域的最高级内容。

newsCategories
   .Where(x => newsCategories
                       .Any(y => x != y && !x.Axes.IsDescendantOf(y)))

以及

newsCategories
   .Where(x => newsCategories
                       .Any(y => x != y && !x.Axes.IsDescendantOf(y)))
最佳回答

我必须相信,现场计分方法应为:not>。 根据你的调查结果,并迅速研究现场记分法,这些方法应当真正命名为< 代码>IsAncestorOr Self和。 Or Self

例如,

Sitecore.Data.Items.Item x = //some item;
Sitecore.Data.Items.Item y = //some item;
x.Axes.IsAncestorOf(y)
x.Axes.IsDescendantOf(y)

<代码>IsAncestorOf 这种方法比较了<代码>x.ID == y.ID。 然后将<代码>x.ID与>、ID及母体加以比较,因此应将其命名为。 IsAncestorOr Self

http://www.ohchr.org。 <代码>LongID path of x_starts with the LongID path of y. 鉴于这种扼杀总是以同样的措辞开始,我们再次看到,这一方法应当被点名<代码>。 Or Self。

FYI, A LongID path looks like this /{11111111-1111-1111-1111-111111111111}/{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}/{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} and I suspect is used rather than /sitecore/content/home in order to get around the fact that sitecore allows siblings to have the same name.

问题回答

You are hitting a "fail safe" in the Sitecore logic. It is because you are checking the same item against it self. You need to perform this with 2 different items to produce any result.





相关问题
How do I hook the Save event in Sitecore Page Editor?

I m creating a custom edit control for my content authors to use in the Page Editor. Of course this means I want my control to save data to an Item when the user clicks on the Save button. How is ...

Passing Parameters to a Sitecore Sublayout

I ve done this before with a web control, but I can t seem to get it to work with a sublayout. On the Presentation Details for a particular item I m assigning my Sublayout and then in the additional ...

Lucene.Net Search List

I m using Sitecore and have a multilist field I d like to use Lucene to search on. The problem I have is that the field is a pipe-delimited list of actual values and there could be between 0 and an ...

Test for Descendant Items

I am trying to create a simple inventory of items in a Sitecore website using an xslt. The problem is that I can t find a way to test whether an item has descendant items beneath it. It s easy to ...

Sitecore set/change default language from en

Can anyone recommend the best way to change the default language in Sitecore 6.1. On a fresh install, the typical language for all items is en English, witha nice little USA flag and all. However, ...

热门标签