// 获取字段或属性值 object ColValueMap(ServerBusinessLogItem <T> item, string f) { if (f == "ID") { return(item.ID); } else if (f == "DT") { return(item.dt); } else if (f == "Data") { return(null); } else { FieldInfo fi = t.GetField(f); if (fi != null) { return(fi.GetValue(item.d)); } PropertyInfo pi = t.GetProperty(f); if (pi != null) { return(pi.GetValue(item.d, null)); } return(null); } }
// 记录数据 public void Log(T data) { if (!started) { MakeSureStarted(); } ServerBusinessLogItem <T> d = new ServerBusinessLogItem <T>(maxID++); d.d = data; d.dt = DateTime.Now; p.AddNew(d); }