Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
It seems that the only solution that we've found is via SiteDefinitionRepository. You will not get the Current SiteDefininiton but all possible values.
var siteDefinitionRepository = ServiceLocator.Current.GetInstance<SiteDefinitionRepository>(); var siteDefinitions = siteDefinitionRepository.List().ToList();
We are trying to acces `SiteDefinition.Current` at the time of `AfterInstall`. What we need is `SiteUrl` and `Id` but it seems that at the time of this event they are not available.
How can we postpone the calling of `AfterInstall` or otherwise, could we attach an event listener in `AfterInstall` that can later in the pipeline provide us the data?
Update:
From what I can see in the documentation and from here (enumerating the order of the execution of dependencies), decorating the class like the following should have EPiServer.Web initialized, and by extent, SiteDefinition.Current.
[InitializableModule] [ModuleDependency(typeof(Web.InitializationModule))] public class ModulePackageInitializer : PackageInitializer
I first add the following attributes to the class with no results.
[InitializableModule] [ModuleDependency(typeof(EPiServer.Packaging.PackageInitializer))] public class ModulePackageInitializer : PackageInitializer
Adding a event handler to the InitComplete still doesn't get the values:
public override void Initialize(InitializationEngine context) { base.Initialize(context); context.InitComplete += InitCompleteHandler; [...]