本文整理汇总了C#中ContentItem.GetTrail方法的典型用法代码示例。如果您正苦于以下问题:C# ContentItem.GetTrail方法的具体用法?C# ContentItem.GetTrail怎么用?C# ContentItem.GetTrail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentItem
的用法示例。
在下文中一共展示了ContentItem.GetTrail方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BelowOrSelf
public static ParameterCollection BelowOrSelf(ContentItem ancestorOrSelf)
{
return Parameter.Equal("ID", ancestorOrSelf.ID)
| Parameter.Like("AncestralTrail", ancestorOrSelf.GetTrail() + "%");
}
示例2: UpdateAncestralTrailRecursive
private IEnumerable<ContentItem> UpdateAncestralTrailRecursive(ContentItem source, ContentItem destination)
{
source.AncestralTrail = destination.GetTrail();
foreach (var child in source.Children)
{
yield return child;
foreach (var descendant in UpdateAncestralTrailRecursive(child, source))
yield return descendant;
}
}
示例3: Below
public static Parameter Below(ContentItem ancestor)
{
return Parameter.Like("AncestralTrail", ancestor.GetTrail() + "%");
}
示例4: IsAncestorOrSelf
public static IQueryAction IsAncestorOrSelf(this IQueryBuilder builder, ContentItem descendant)
{
return builder.ID.In(descendant.GetTrail().Split('/').Where(id => !string.IsNullOrEmpty(id)).Select(id => int.Parse(id)).Union(new [] { descendant.ID }).ToArray());
}
示例5: IsDescendantOrSelf
public static IQueryAction IsDescendantOrSelf(this IQueryBuilder builder, ContentItem ancestor)
{
return builder.OpenBracket().AncestralTrail.Like(ancestor.GetTrail() + "%").Or.ID.Eq(ancestor.ID).CloseBracket();
}
示例6: IsDescendant
public static IQueryAction IsDescendant(this IQueryBuilder builder, ContentItem ancestor)
{
return builder.AncestralTrail.Like(ancestor.GetTrail() + "%");
}
示例7: SetChildren
private void SetChildren(ContentItem item)
{
item.Children = new ItemList(() => database.GetCollection<ContentItem>().Find(Query.EQ("AncestralTrail", item.GetTrail())));
}