using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration; namespace EMIS.ViewModel { public class FileUploadConfig : IConfigurationSectionHandler { public FileUploadConfig() { ServiceTypes = new Dictionary(); } public Dictionary ServiceTypes { get; set; } public object Create(object parent, object configContext, System.Xml.XmlNode section) { FileUploadConfig config = new FileUploadConfig(); var sectionConfigList = section.SelectNodes("add"); for (int i = 0; i < sectionConfigList.Count; i++) { var sectionConfig = sectionConfigList.Item(i); if (sectionConfig != null && sectionConfig.Attributes != null) { var name = sectionConfig.Attributes["name"]; var value = sectionConfig.Attributes["value"]; if (name != null && value != null) { if (name.Value != null && value.Value != null) { config.ServiceTypes.Add(name.Value, value.Value); } } } } return config; } } }