Re-factored IIS 7 provider to improve GetSite() operation performance.

This commit is contained in:
feodor_fitsner 2011-12-12 15:04:33 -08:00
parent 58b073a6aa
commit eb64f13221
21 changed files with 1058 additions and 1058 deletions

View file

@ -43,31 +43,28 @@ namespace WebsitePanel.Providers.Web.Iis.DefaultDocuments
{
public const string ValueAttribute = "value";
public string GetDefaultDocumentSettings(string siteId)
public string GetDefaultDocumentSettings(ServerManager srvman, string siteId)
{
using (var srvman = GetServerManager())
// Load web site configuration
var config = srvman.GetWebConfiguration(siteId);
// Load corresponding section
var section = config.GetSection(Constants.DefaultDocumentsSection);
//
var filesCollection = section.GetCollection("files");
// Build default documents
var defaultDocs = new List<String>();
//
foreach (var item in filesCollection)
{
// Load web site configuration
var config = srvman.GetWebConfiguration(siteId);
// Load corresponding section
var section = config.GetSection(Constants.DefaultDocumentsSection);
var item2Get = GetDefaultDocument(item);
//
var filesCollection = section.GetCollection("files");
// Build default documents
var defaultDocs = new List<String>();
if (String.IsNullOrEmpty(item2Get))
continue;
//
foreach (var item in filesCollection)
{
var item2Get = GetDefaultDocument(item);
//
if (String.IsNullOrEmpty(item2Get))
continue;
//
defaultDocs.Add(item2Get);
}
//
return String.Join(",", defaultDocs.ToArray());
defaultDocs.Add(item2Get);
}
//
return String.Join(",", defaultDocs.ToArray());
}
public void SetDefaultDocumentsEnabled(string siteId, bool enabled)