Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm interested in understanding which is best way of retrieving nodes that are located in a branch different from the one where my current node is.
At the moment I'm doing:
var entities = Umbraco.TypedContentAtRoot() .First() .DescendantsOrSelf("Taxonomy") .Where(x => x.Name == "Bodies");
But I was wondering if, performance wise, it's better to first select the specific root, and then search only inside it.
var entities = Umbraco.TypedContentAtRoot() .Single(x => x.DocumentTypeAlias == "Settings") .Descendants() .Where(x => x.DocumentTypeAlias == "Taxonomy" && x.Name == "Bodies");
In theory I could also store in my app.config the actual node of which I need to list the children, but I'd prefer to avoid doing that.
Hi Simine,
The best is - use Descendants never! In my opinion it's better to hardcode node id in config, it's much faster than doing Descdendants.
Thanks
Don't really like hard-coding ids. Maybe going for navigating children and then children would it be faster?
I mean, descendants gets everything, while with children you only search within the levels and branches you know.
Children and children is faster than descendants.
I don't like hardcoding ids too, but as I understand you need some node, you don't need go through all site and find it, you know that this node you need, so as I understand id will be ok.
Examine all the things, so you can use examine searches to get stuff from different parts of the site its lightening quick.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Querying content in other branches of the node tree: what is the best practice?
I'm interested in understanding which is best way of retrieving nodes that are located in a branch different from the one where my current node is.
At the moment I'm doing:
But I was wondering if, performance wise, it's better to first select the specific root, and then search only inside it.
In theory I could also store in my app.config the actual node of which I need to list the children, but I'd prefer to avoid doing that.
Hi Simine,
The best is - use Descendants never! In my opinion it's better to hardcode node id in config, it's much faster than doing Descdendants.
Thanks
Don't really like hard-coding ids. Maybe going for navigating children and then children would it be faster?
I mean, descendants gets everything, while with children you only search within the levels and branches you know.
Children and children is faster than descendants.
I don't like hardcoding ids too, but as I understand you need some node, you don't need go through all site and find it, you know that this node you need, so as I understand id will be ok.
Thanks
Examine all the things, so you can use examine searches to get stuff from different parts of the site its lightening quick.
is working on a reply...