コード例 #1
0
 /// <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));
     }
 }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <summary>
        /// 获得DomainObject中定义了FieldMapAttribute的属性名或字段名
        /// </summary>
        /// <param name="type">DomainObject的类型</param>
        /// <returns></returns>
        public static ArrayList GetDomainObjectScheme(Type type)
        {
            ArrayList array  = DomainObjectUtility.GetMemberInfos(type);
            ArrayList scheme = new ArrayList(array.Count);

            foreach (MemberInfo info in array)
            {
                scheme.Add(info.Name);
            }

            return(scheme);
        }
コード例 #4
0
        public static void SetValue(object domainObject, string propertyName, object value)
        {
            ArrayList  infos = DomainObjectUtility.GetMemberInfos(domainObject);
            MemberInfo info1 = null;

            foreach (MemberInfo info in infos)
            {
                if (info.Name == propertyName)
                {
                    info1 = info;
                    break;
                }
            }

            if (info1 == null)
            {
                throw new Exception("$Error_Property_Name_Not_Exist");
            }

            DomainObjectUtility.SetValue(domainObject, info1, value);
        }
コード例 #5
0
 public static Hashtable GetNonKeyAttributeMemberInfos(Type type)
 {
     return(DomainObjectUtility.GetNonKeyAttributeMemberInfos(DomainObjectUtility.GetTableMapAttribute(type), DomainObjectUtility.GetMemberInfos(type)));
 }
コード例 #6
0
 public static Hashtable GetNonKeyAttributeMemberInfos(object obj)
 {
     return(DomainObjectUtility.GetNonKeyAttributeMemberInfos(DomainObjectUtility.GetTableMapAttribute(obj), DomainObjectUtility.GetMemberInfos(obj)));
 }
コード例 #7
0
 public static ArrayList GetMemberInfos(object obj)
 {
     return(DomainObjectUtility.GetMemberInfos(obj.GetType()));
 }
コード例 #8
0
 public static Hashtable GetAttributeMemberInfos(Type type)
 {
     lock (hashtableAttributeMember)
     {
         if (hashtableAttributeMember.ContainsKey(type.FullName) == false)
         {
             hashtableAttributeMember.Add(type.FullName, DomainObjectUtility.GetAttributeMemberInfos(DomainObjectUtility.GetMemberInfos(type)));
         }
     }
     return((Hashtable)hashtableAttributeMember[type.FullName]);
 }