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 have multiple root nodes - just wondering was the best way to navigate to say the b node and grab x property?
Have been using the below - but worried about performance.
var root = Model.AncestorOrSelf(1);
var settings = root.Siblings().FirstOrDefault(x => x.ContentType.Alias == "MyNodeAlias");
var property= settings.Value("MyProperty");
You could try this and compare performance.
var settings = Umbraco.ContentAtRoot().FirstOrDefault(x => x.ContentType.Alias == "MyNodeAlias");
var property = settings.Value("MyProperty");
Another option you have, is have a picker on your home node that allows you to pick the settings node.
Then you can do Model.Root().Value<IPublishedContent>("settings") to get the setting node.
All of the suggested options can work, and in reality there isn't much of a performance issue in using Siblings approach as everything is in memory anyway.
Any benefit using something like
var settings = Umbraco.ContentSingleAtXPath("//MyNodeAlias");
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted