private ColumnMetadataCollection ScanClass(Type clsType) { var Res = new ColumnMetadataCollection(); var Members = clsType.GetMembers(BindingFlags.Instance | BindingFlags.GetField | BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Public); foreach (MemberInfo Mbr in Members) { var ColAttrs = Mbr.GetCustomAttributes(typeof(Attributes.Column), true); if (ColAttrs.Length == 1) { var NewCol = ColumnMetadataFromColumnAttribute(Mbr, ColAttrs[0] as Attributes.Column); var IdAttrs = Mbr.GetCustomAttributes(typeof(Attributes.Id), true); if (IdAttrs.Length == 1) { NewCol.Id = true; } var AssocAttrs = Mbr.GetCustomAttributes(typeof(Attributes.Association), true); if (AssocAttrs.Length == 1) { NewCol.AssociationMetada = AssociationMetadataFromAttribute(AssocAttrs[0] as Attributes.Association); } Res.Add(NewCol); } } return(Res); }
public ColumnMetadataCollection GetIdColumns() { var Res = new ColumnMetadataCollection(); foreach (var Col in this) { if (Col.Id) { Res.Add(Col); } } return(Res); }