This is not a question, it's info in case anyone ever has the same issue as me.
I use the dictionary to save what should be static text (e.g. 'Title', 'First name', 'Surname'), even though we only have one language. It helps bridge the gap between putting everything in the CMS, which would cause confusion, and having complaints that certain text can't be changed. When we which to use 'Last name' instead of 'Surname' it is no problem.
Unfortunately the dictionary items aren't cached. They're lazy loaded using individual database requests. This means that when your site starts up it is going to start making loads of database request. To resolve this I've create a dictionary what preloads all the dictionary items on start-up. Perhaps it will be a useful addition to someone else who uses the dictionary in the same way.
NB: This will not work as it is for multiple languages, though you'd only need to modify this to have an array of dictionaries (one per language) to do so.
FYI: Pre-caching the single language dictionary
This is not a question, it's info in case anyone ever has the same issue as me.
I use the dictionary to save what should be static text (e.g. 'Title', 'First name', 'Surname'), even though we only have one language. It helps bridge the gap between putting everything in the CMS, which would cause confusion, and having complaints that certain text can't be changed. When we which to use 'Last name' instead of 'Surname' it is no problem.
Unfortunately the dictionary items aren't cached. They're lazy loaded using individual database requests. This means that when your site starts up it is going to start making loads of database request. To resolve this I've create a dictionary what preloads all the dictionary items on start-up. Perhaps it will be a useful addition to someone else who uses the dictionary in the same way.
https://gist.github.com/anonymous/1f55bfcd92b74092a6687d38fb186542
NB: This will not work as it is for multiple languages, though you'd only need to modify this to have an array of dictionaries (one per language) to do so.
Issue with that gist code. You'll end up with a new dictionary for every UmbracoHelper. This use this instead for the factory:
is working on a reply...