I have a node in Umbraco that I store sitewide settings in. We now have a need to get to these on app start. We have a class which extends AppBase to handle the onstart call but it is falling over when I try getting the node:
var settings = new Node( 1234 ); // Silently fails with object reference error
So some quick sanity checking, can I even access Node's on start up? Is there a better way of doing what I'm after? Quite liked having the settings in a nice easy UI so would like to keep it that way if I can.
Can you access node on AppStart?
I have a node in Umbraco that I store sitewide settings in. We now have a need to get to these on app start. We have a class which extends AppBase to handle the onstart call but it is falling over when I try getting the node:
So some quick sanity checking, can I even access Node's on start up? Is there a better way of doing what I'm after? Quite liked having the settings in a nice easy UI so would like to keep it that way if I can.
Cheers
Pete
At a guess, maybe the internal XML cache hasn't been loaded yet. Have you tried working with Document which hits the database rather than the cache?
Matt
That got it, cheer mate.
Cool,
Using Document obviously has a performance hit, but as long as you are doing it only once at app start, can't see it being a problem.
Matt
is working on a reply...