public List<WebConfigEntry> GetByFilter(WebConfigEntryFilter filter) { List<WebConfigEntry> result = new List<WebConfigEntry>(); Configuration configuration = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath); AppSettingsSection appSettingsSection = (AppSettingsSection)configuration.GetSection("appSettings"); if (appSettingsSection != null) { if (!string.IsNullOrEmpty(filter.Key)) { result.Add(GetByKey(filter.Key)); } else { foreach (string key in appSettingsSection.Settings.AllKeys) { WebConfigEntry item = new WebConfigEntry(); item.Key = key; item.Value = appSettingsSection.Settings[key].Value; result.Add(item); } } } return result; }
public Dictionary<string, string> GetList() { Dictionary<string, string> res = new Dictionary<string, string>(); WebConfigEntryFilter filter = new WebConfigEntryFilter(); List<WebConfigEntry> list = GetByFilter(filter); foreach (WebConfigEntry item in list) { res.Add(item.Key, item.Value); } return res; }
protected void ObjDs1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { WebConfigEntryFilter filter = new WebConfigEntryFilter(); e.InputParameters["filter"] = filter; }