コード例 #1
0
        /// <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)));
        }
コード例 #2
0
        /// <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)));
        }
コード例 #3
0
 public static Hashtable GetKeyAttributeMemberInfos(Type type)
 {
     return(DomainObjectUtility.GetKeyAttributeMemberInfos(DomainObjectUtility.GetTableMapAttribute(type), DomainObjectUtility.GetMemberInfos(type)));
 }
コード例 #4
0
 public static Hashtable GetKeyAttributeMemberInfos(object obj)
 {
     return(DomainObjectUtility.GetKeyAttributeMemberInfos(DomainObjectUtility.GetTableMapAttribute(obj), DomainObjectUtility.GetMemberInfos(obj)));
 }