public VerticalWebSiteApplications(IVerticalsQuery verticalsQuery, Func <WebSite, string, string> getHost, Func <WebSite, int> getPort, Func <WebSite, string> getApplicationPath) { // Add a default. var webSiteApplications = new WebSiteApplications(Guid.Empty); foreach (WebSite webSite in Enum.GetValues(typeof(WebSite))) { var host = getHost(webSite, null); var port = getPort(webSite); var applicationPath = getApplicationPath(webSite); if (port != Url.InsecurePort || applicationPath != null) { webSiteApplications.Add(webSite, host, port, applicationPath); } } Add(webSiteApplications); // Set up a collection for each vertical that has its own host defined. foreach (var vertical in verticalsQuery.GetVerticals()) { if (!string.IsNullOrEmpty(vertical.Host)) { webSiteApplications = new WebSiteApplications(vertical.Id); foreach (WebSite webSite in Enum.GetValues(typeof(WebSite))) { var host = getHost(webSite, vertical.Host); var port = getPort(webSite); var applicationPath = getApplicationPath(webSite); if (port != Url.InsecurePort || applicationPath != null) { webSiteApplications.Add(webSite, host, port, applicationPath); } } Add(webSiteApplications); } } }
private void Add(WebSiteApplications applications) { _webSiteApplications[applications.VerticalId] = applications; }