Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonydotnet/604a8c26c19748d07313a1730d8d0647 to your computer and use it in GitHub Desktop.
Save anthonydotnet/604a8c26c19748d07313a1730d8d0647 to your computer and use it in GitHub Desktop.
public IPublishedContent GetGlobalContentNode()
{
const string CacheKey = "Application.BusinessLogic.Services.GetGlobalContentNode";
var globalContentNode = HttpContext.Current.Items[CacheKey] as IPublishedContent;
if (globalContentNode == null)
{
var settingsNode = GetNonPageContentNode();
//Get the child folder node - Configuration Folder
var configFolder = settingsNode.Children.SingleOrDefault(x => x.DocumentTypeAlias == Constants.DocTypes.SiteConfigurationFolder);
if (configFolder == null) { return null; }
//Try & get the child External Services node
globalContentNode = configFolder.Children.SingleOrDefault(x => x.DocumentTypeAlias == Constants.DocTypes.GlobalContent);
return globalContentNode;
}
return globalContentNode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment