示例#1
0
 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;
 }
示例#2
0
 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;
 }
示例#3
0
 protected void ObjDs1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
 {
     WebConfigEntryFilter filter = new WebConfigEntryFilter();
     e.InputParameters["filter"] = filter;
 }