1 protected static ConfigInfo Get()
2 {
3 var ci = new ConfigInfo();
4 IDataReader dr =ExecuteReader("**", null);
5 var ht = new Hashtable();
6 while (dr.Read())
7 {
8 ht.Add(dr["name"], dr["value"]);
9 }
10 dr.Close();
11 PropertyInfo[] p = ci.GetType().GetProperties();
12 foreach (PropertyInfo pi in p)
13 {
14 pi.SetValue(ci, Convert.ChangeType(ht[pi.Name], pi.MemberType.GetTypeCode()), null);
15 }
16 HttpContext.Current.Trace.Warn((string) ht[""]);
17 foreach (object o in ht.Keys)
18 {
19 HttpContext.Current.Trace.Warn((string) o);
20//http://ysoho.cnblogs.com }
21 return ci;
22 }
2 {
3 var ci = new ConfigInfo();
4 IDataReader dr =ExecuteReader("**", null);
5 var ht = new Hashtable();
6 while (dr.Read())
7 {
8 ht.Add(dr["name"], dr["value"]);
9 }
10 dr.Close();
11 PropertyInfo[] p = ci.GetType().GetProperties();
12 foreach (PropertyInfo pi in p)
13 {
14 pi.SetValue(ci, Convert.ChangeType(ht[pi.Name], pi.MemberType.GetTypeCode()), null);
15 }
16 HttpContext.Current.Trace.Warn((string) ht[""]);
17 foreach (object o in ht.Keys)
18 {
19 HttpContext.Current.Trace.Warn((string) o);
20//http://ysoho.cnblogs.com }
21 return ci;
22 }