From 8e7630cd9c027c17931342eab580c8e826a76276 Mon Sep 17 00:00:00 2001 From: Maarten Kieft Date: Thu, 17 May 2018 12:09:15 +0200 Subject: [PATCH] Make Base AnchestorOrSelf function public By making this function public, developers can use it to iterate over the tree on different property / function than the ones which are created. It makes umbraco easier to extend. Now we have to copy existing code in order to do this. --- src/Umbraco.Web/PublishedContentExtensions.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 6091c6c7dc..d44ea4e3b9 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -502,10 +502,10 @@ namespace Umbraco.Web where T : class, IPublishedContent { return new PublishedContentOrderedSet(source); - } - + } + #endregion - + #region Dynamic Linq Extensions [Obsolete("This method uses dynamics which will be removed in future versions, use strongly typed syntax instead")] @@ -517,7 +517,7 @@ namespace Umbraco.Web } [Obsolete("This method uses dynamics which will be removed in future versions, use strongly typed syntax instead")] - [EditorBrowsable(EditorBrowsableState.Never)] + [EditorBrowsable(EditorBrowsableState.Never)] public static IQueryable Where(this IEnumerable list, string predicate) { // wrap in DynamicPublishedContentList so that the ContentSet is correct @@ -530,7 +530,7 @@ namespace Umbraco.Web } [Obsolete("This method uses dynamics which will be removed in future versions, use strongly typed syntax instead")] - [EditorBrowsable(EditorBrowsableState.Never)] + [EditorBrowsable(EditorBrowsableState.Never)] public static IEnumerable> GroupBy(this IEnumerable list, string predicate) { var dList = new DynamicPublishedContentList(list); @@ -538,7 +538,7 @@ namespace Umbraco.Web } [Obsolete("This method uses dynamics which will be removed in future versions, use strongly typed syntax instead")] - [EditorBrowsable(EditorBrowsableState.Never)] + [EditorBrowsable(EditorBrowsableState.Never)] public static IQueryable Select(this IEnumerable list, string predicate, params object[] values) { var dList = new DynamicPublishedContentList(list); @@ -560,8 +560,8 @@ namespace Umbraco.Web if (content == null) throw new ArgumentNullException("content"); return new HtmlString(content.Where(predicate) ? valueIfTrue : valueIfFalse); } - - [Obsolete("This method uses dynamics which will be removed in future versions, use strongly typed syntax instead: Where(x => x.IsVisible())")] + + [Obsolete("This method uses dynamics which will be removed in future versions, use strongly typed syntax instead: Where(x => x.IsVisible())")] [EditorBrowsable(EditorBrowsableState.Never)] public static bool Where(this IPublishedContent content, string predicate) { @@ -1199,7 +1199,7 @@ namespace Umbraco.Web return content.AncestorsOrSelf(maxLevel).FirstOrDefault(); } - internal static IEnumerable AncestorsOrSelf(this IPublishedContent content, bool orSelf, Func func) + public static IEnumerable AncestorsOrSelf(this IPublishedContent content, bool orSelf, Func func) { var ancestorsOrSelf = content.EnumerateAncestors(orSelf); return func == null ? ancestorsOrSelf : ancestorsOrSelf.Where(func);