I'm just not figuring out the proper selector expression to single out a page located under a parent using the SelectRecursive() option and need some assistance. Here's my code of interest:
foreach (var item in Items) { var kid = contentService.GetDescendants(parentPage).SelectRecursive(p => p.Name.Equals(item.Textpage));
... kid does chores here ... }
Cannot convert expression type 'bool' to return type 'System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IContent>'
Do you need to use the conten service for this? If your looking for published content in the website you can use IPublishedContent which might have some better helpers.
I am using the content service. After messing around with it, doing the following worked for what I was wanting to do:
foreach (var item in Items) { var kid = contentService.GetDescendants(parentPage).First(p => p.Name.Equals(item.Textpage));
... kid does chores here ... }
Apparently GetDescendants() flattens all children to a list compared to GetChildren(). I'd still like to know how to use SelectRecursive() for future reference and to see if it's better performing than what I'm using. What I have now would at least return me a single IContent than an IEnumerable<IContent>.
Requesting SelectRecursive() Example (v6)
I'm just not figuring out the proper selector expression to single out a page located under a parent using the SelectRecursive() option and need some assistance. Here's my code of interest:
Cannot convert expression type 'bool' to return type 'System.Collections.Generic.IEnumerable<Umbraco.Core.Models.IContent>'
Hello,
Do you need to use the conten service for this? If your looking for published content in the website you can use IPublishedContent which might have some better helpers.
Jeroe
I am using the content service. After messing around with it, doing the following worked for what I was wanting to do:
Apparently GetDescendants() flattens all children to a list compared to GetChildren(). I'd still like to know how to use SelectRecursive() for future reference and to see if it's better performing than what I'm using. What I have now would at least return me a single IContent than an IEnumerable<IContent>.
is working on a reply...