public bool SaveConfig(BaseConfig model) { //return SerializationHelper.Save(model, this.xmlpath); Type type = model.GetType(); Lebi_Config cf; foreach (System.Reflection.PropertyInfo p in type.GetProperties()) { if (p.GetValue(model, null) == null) { continue; } cf = B_Lebi_Config.GetModel("Name='" + p.Name + "'"); if (cf == null) { cf = new Lebi_Config(); cf.Name = p.Name; cf.Value = p.GetValue(model, null).ToString(); B_Lebi_Config.Add(cf); } else { cf.Name = p.Name; cf.Value = p.GetValue(model, null).ToString(); B_Lebi_Config.Update(cf); } } ShopCache.SetBaseConfig();//更新缓存 return(true); }
IConfigInstance <BaseConfig> IConfigManager.GetInstanceInfo(BaseConfig instance) { Type instanceType = instance.GetType(); return(Array.Find(infoList, info => info.Instance.GetType() == instanceType)); // TODO handle null }