Example #1
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]);
 }
Example #2
0
        /// <summary>
        /// 获得DomainObject对应的所有数据库字段名
        /// </summary>
        /// <param name="type">DomainObject的类型</param>
        /// <returns></returns>
        public static ArrayList GetDomainObjectFieldsName(Type type)
        {
            Hashtable hs    = DomainObjectUtility.GetAttributeMemberInfos(type);
            ArrayList array = new ArrayList(hs.Count);

            foreach (FieldMapAttribute attr in hs.Keys)
            {
                array.Add(attr.FieldName);
            }

            return(array);
        }
Example #3
0
        public static DomainObject FillDomainObject(object obj, DataRow dataRow)
        {
            Hashtable hs       = DomainObjectUtility.GetAttributeMemberInfos(obj);
            Hashtable hsFields = GetFieldNameMapAttribute(obj.GetType().FullName, hs);

            foreach (DataColumn column in dataRow.Table.Columns)
            {
                if (hsFields.Contains(column.ColumnName.ToUpper()))
                {
                    DomainObjectUtility.SetValue(obj, (MemberInfo)hsFields[column.ColumnName.ToUpper()], dataRow[column.ColumnName]);
                }
            }

            return((DomainObject)obj);
        }