/// <summary> /// 设置_模型_数据 /// </summary> /// <param name="info">行信息</param> /// <param name="target_model">目标模型</param> /// <param name="ov">数据</param> /// <returns>目标模型</returns> public AbsShineUpon SetValue_Object(ShineUponInfo info, AbsShineUpon target_model, object ov) { if (!CheckData.IsObjectNull(ov) && info.Property.CanWrite) { Type itype = info.Property.PropertyType; object oo = ConvertTool.ToObject(itype, ov); info.Property.SetValue(target_model, oo, null); } return(target_model); }
/// <summary> /// 获取_模型_数据 /// </summary> /// <param name="info">行信息</param> /// <param name="model">数据来源</param> /// <returns>键值数据</returns> public KeyObject GetValue_KeyObject(ShineUponInfo info, AbsShineUpon model) { if (CheckData.IsObjectNull(info) || CheckData.IsObjectNull(model)) { return(null); } object ov = info.Property.GetValue(model, null); return(new KeyObject(info.Property.Name, ov)); }
/// <summary> /// 获取_模型_数据 /// </summary> /// <param name="info">行信息</param> /// <param name="model">数据来源</param> /// <returns>键值数据</returns> public KeyString GetValue_KeyString(ShineUponInfo info, AbsShineUpon model) { KeyObject ko = GetValue_KeyObject(info, model); if (CheckData.IsObjectNull(ko)) { return(null); } string sv = ConvertTool.ToString(ko.Value); return(new KeyString(ko.Key, sv)); }
/// <summary> /// 读取: ini.file => model /// </summary> public void IniConfig_Read(AbsShineUpon model) { Type mtype = model.GetType(); string section_name = mtype.FullName; ShineUponParser perser = new ShineUponParser(mtype); foreach (ShineUponInfo info in perser.GetDictionary().Values) { string sinival = ReadString(section_name, info.Name, string.Empty); if (CheckData.IsStringNull(sinival)) { continue; } perser.SetValue_Object(info, model, sinival); } }