/// <summary> /// Provisions the service locator settings, and ensures the list is created for storing configuration /// on the site collection root web. The service locator configuration is defined for the site level. /// </summary> /// <param name="properties">The properties for this configuration</param> public override void FeatureActivated(SPFeatureReceiverProperties properties) { string configListLocation = CentralSiteConfig.GetCentralConfigSiteUrl(); // Configuration List Deployment using (var centralSite = new SPSite(configListLocation)) { ConfigurationList.EnsureConfigurationList(centralSite); } var site = properties.Feature.Parent as SPSite; var slConfig = SharePointServiceLocator.GetCurrent(site).GetInstance <IServiceLocatorConfig>(); slConfig.Site = site; slConfig.RegisterTypeMapping <IConfigManager, ListBackedConfigManager>(); slConfig.RegisterTypeMapping <IHierarchicalConfig, ListBackedHierarchicalConfig>(); SharePointServiceLocator.Reset(); ConfigurationList.EnsureConfigurationList(site); // Add WP to new page and add to navigation AddWPToSiteNavigation(site.RootWeb, "listconfig.aspx", "List Configuration Test", wpXml, "left"); }
/// <summary> /// Provisions the centralized list for the configuration manager. Web app and server /// settings need to be stored in the centralized list. SetCentralConfigUrl stores the /// location in config for this list that can subsequently be used by the property bags for /// web app and farm. /// </summary> /// <param name="properties">The context properties for feature installed</param> public override void FeatureInstalled(SPFeatureReceiverProperties properties) { CentralSiteConfig.SetCentralConfigUrl("http://localhost/"); }