/// <summary> /// 将src中各属性的值复制到des中 /// </summary> /// <param name="src"></param> /// <param name="des"></param> public static void MembersClone(DomainObject src, DomainObject des) { foreach (MemberInfo info in DomainObjectUtility.GetMemberInfos(src)) { DomainObjectUtility.SetValue(des, info.Name, DomainObjectUtility.GetValue(src, info, null)); } }
/// <summary> /// 获得DomainObject中定义了FieldMapAttribute,且为主键的属性名或字段名的值 /// </summary> /// <param name="obj">DomainObject</param> /// <returns></returns> public static object[] GetDomainObjectKeyValues(DomainObject obj) { Hashtable ht = DomainObjectUtility.GetKeyAttributeMemberInfos(obj); ArrayList values = new ArrayList(ht.Count); foreach (MemberInfo info in ht.Values) { values.Add(DomainObjectUtility.GetValue(obj, info, null)); } return((object[])values.ToArray(typeof(object))); }
/// <summary> /// 获得DomainObject中定义了FieldMapAttribute的属性名或字段名的值 /// </summary> /// <param name="obj">DomainObject</param> /// <returns></returns> public static ArrayList GetDomainObjectValues(DomainObject obj) { ArrayList array = DomainObjectUtility.GetMemberInfos(obj); ArrayList values = new ArrayList(array.Count); foreach (MemberInfo info in array) { values.Add(DomainObjectUtility.GetValue(obj, info, null)); } return(values); }