/// <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="type">DomainObject的类型</param> /// <returns></returns> public static string[] GetDomainObjectKeyScheme(Type type) { Hashtable ht = DomainObjectUtility.GetKeyAttributeMemberInfos(type); ArrayList scheme = new ArrayList(ht.Count); foreach (MemberInfo info in ht.Values) { scheme.Add(info.Name); } return((string[])scheme.ToArray(typeof(string))); }
public static Hashtable GetKeyAttributeMemberInfos(Type type) { return(DomainObjectUtility.GetKeyAttributeMemberInfos(DomainObjectUtility.GetTableMapAttribute(type), DomainObjectUtility.GetMemberInfos(type))); }
public static Hashtable GetKeyAttributeMemberInfos(object obj) { return(DomainObjectUtility.GetKeyAttributeMemberInfos(DomainObjectUtility.GetTableMapAttribute(obj), DomainObjectUtility.GetMemberInfos(obj))); }