示例#1
0
        public static string GetFileInfor(PropertyInfo p)
        {
            if (p == null)
            {
                return("");
            }

            string          name = "";
            string          type = "";
            DFieldAttribute attr = null;

            object[] olist = p.GetCustomAttributes(typeof(DFieldAttribute), false);
            if (olist != null && olist.Length > 0)
            {
                attr = olist[0] as DFieldAttribute;
            }

            if (attr == null)
            {
                name = p.Name + " ";
                type = "nvarchar(50) NULL";
            }
            else
            {
                name = attr.Name + " ";
                type = attr.Type;
            }

            string infor = name + type;

            return(infor);
        }
示例#2
0
        public static string GetFieldName(PropertyInfo p)
        {
            if (p == null)
            {
                return("");
            }

            object[] olist = p.GetCustomAttributes(typeof(DFieldAttribute), false);
            if (olist == null || olist.Length < 1)
            {
                return(p.Name);
            }

            DFieldAttribute attr = olist[0] as DFieldAttribute;

            if (attr != null)
            {
                return(attr.Name);
            }

            return(p.Name);
        }