private static QueryColumn CreateFromAttribute(ActiveColumnAttribute attr, MemberInfo info, TableData parentTable) { ForeignColumnAttribute foreignAttr = Attribute.GetCustomAttribute(info, typeof(ForeignColumnAttribute)) as ForeignColumnAttribute; LocalizableColumnAttribute localizeAttr = Attribute.GetCustomAttribute(info, typeof(LocalizableColumnAttribute)) as LocalizableColumnAttribute; return(new TableColumnData(parentTable, attr.Name, attr.DbType, attr.MaxLength, attr.ColumnProperties, attr.DefaultValue, null, foreignAttr == null ? null : Create(foreignAttr), localizeAttr == null ? null : Create(localizeAttr))); }
public void FromExternalDecoratedClassGetAllPropertyAttributes() { Type type = typeof(Derived); PropertyInfo[] pinfo = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); ForeignColumnAttribute attr = (ForeignColumnAttribute)Attribute.GetCustomAttribute(pinfo[0], typeof(ForeignColumnAttribute)); Assert.AreEqual(1, pinfo.Length); Assert.IsNotNull(attr); Assert.AreEqual("Name", attr.Name); }