Tried
[ModuleDependency(typeof (EPiServer.Web.InitializationModule))]
and then use ServiceLocator?
Oh, sorry. missed a bit of code...
[InitializableModule] [ModuleDependency(typeof(ServiceContainerInitialization), typeof(EPiServer.Web.InitializationModule))] public class RouteInitalizer : IInitializableModule { ... }
Note that when you use GetChildren without specyfing a language (a LanguageLoaderOption) then the language will be resolved from the context. In case of a normal web request that language is determined from the url (either through host mapping or language segment). However an initializable module is likely to run outside a normal webrequest so in that case is langauge resolved using other available sources like globalization element in web.config.
To ensure a deterministic behaviour I suggest that you expliciclty specify a language when loading content from an initializable module (you can use fallback to master or use LanguageLoaderOption.MasterLanguage() or LanguageSelector.MasterLanguage if you do not know the language at forehand).
Good point! I had some problems with scheduled job that was related to that @Johan. I had some settings on startpage I got on the scheduled job that worked fine on dev,test and stage but bombed on production for the same reason. EPiServer got the wrong language version on production. Took me a while to resolve and quite a few swear words. So specifying language when you dont have the normal web context = important.
Hi,
I have a RouteInitializer that then everything works should initialize a PartialRouter. Everything works fine on my local environment, but as soon as I deploy it to the server GetChildren stop returning items.
Could it be that things run in another order on the server? Do I need another ModuleDependency?
Here is my code (productsPages will be empty):