protected virtual void InitializeEnvironment(IServiceContainer container, ConfigurationManagerWrapper.ContentSectionTable config) { if (config.Web != null) { Url.DefaultExtension = config.Web.Web.Extension; PathData.PageQueryKey = config.Web.Web.PageQueryKey; PathData.ItemQueryKey = config.Web.Web.ItemQueryKey; PathData.PartQueryKey = config.Web.Web.PartQueryKey; PathData.PathKey = config.Web.Web.PathDataKey; var skipList = config.Engine.Components.GetConfiguredServiceTypes(); if (config.Web.Web.IsWeb) { AddComponentUnlessConfigured(container, typeof(N2.Web.IWebContext), typeof(N2.Web.AdaptiveContext), skipList); } else { AddComponentUnlessConfigured(container, typeof(N2.Web.IWebContext), typeof(N2.Web.ThreadContext), skipList); } } if (config.Management != null) { SelectionUtility.SelectedQueryKey = config.Management.Paths.SelectedQueryKey; Url.SetToken("{Selection.SelectedQueryKey}", SelectionUtility.SelectedQueryKey); } }
protected virtual void InitializeEnvironment(IServiceContainer container, ConfigurationManagerWrapper.ContentSectionTable config) { if (config.Web != null) { Url.DefaultExtension = config.Web.Web.Extension; PathData.PageQueryKey = config.Web.Web.PageQueryKey; PathData.ItemQueryKey = config.Web.Web.ItemQueryKey; PathData.PartQueryKey = config.Web.Web.PartQueryKey; if (!config.Web.Web.IsWeb) { container.AddComponentInstance("n2.webContext.notWeb", typeof(IWebContext), new ThreadContext()); } if (config.Web.Web.Urls.EnableCaching) { container.AddComponent("n2.web.cachingUrlParser", typeof(IUrlParser), typeof(CachingUrlParserDecorator)); } if (config.Web.MultipleSites) { container.AddComponent("n2.multipleSitesParser", typeof(IUrlParser), typeof(MultipleSitesParser)); } else { container.AddComponent("n2.urlParser", typeof(IUrlParser), typeof(UrlParser)); } } if (config.Management != null) { SelectionUtility.SelectedQueryKey = config.Management.Paths.SelectedQueryKey; Url.SetToken("{Selection.SelectedQueryKey}", SelectionUtility.SelectedQueryKey); } }