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); }
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); }