/// <summary> /// Constructor for COBieColumn /// </summary> /// <param name="propInfo">PropertyInfo</param> /// <param name="attr">COBieAttributes</param> /// <param name="aliases">List of strings</param> public COBieColumn(PropertyInfo propInfo, COBieAttributes attr, List<string> aliases) { PropertyInfo = propInfo; ColumnName = attr.ColumnName; ColumnLength = attr.MaxLength; AllowedType = attr.AllowedType; AttributeState = attr.State; ColumnOrder = attr.Order; KeyType = attr.KeyType; Aliases = aliases; ReferenceColumnName = attr.ReferenceColumnName; AllowsMultipleValues = attr.AllowedMultipleValues; }
/// <summary> /// Constructor for COBieColumn /// </summary> /// <param name="propInfo">PropertyInfo</param> /// <param name="attr">COBieAttributes</param> /// <param name="aliases">List of strings</param> public COBieColumn(PropertyInfo propInfo, COBieAttributes attr, List <string> aliases) { PropertyInfo = propInfo; ColumnName = attr.ColumnName; ColumnLength = attr.MaxLength; AllowedType = attr.AllowedType; AttributeState = attr.State; ColumnOrder = attr.Order; KeyType = attr.KeyType; Aliases = aliases; ReferenceColumnName = attr.ReferenceColumnName; AllowsMultipleValues = attr.AllowedMultipleValues; }
/// <summary> /// Constructor /// </summary> /// <param name="sheetName">Sheet name for this sheet object</param> public COBieSheet(string sheetName) { Rows = new List <T>(); RowsRemoved = new List <T>(); _indices = new Dictionary <string, HashSet <string> >(); SheetName = sheetName; PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(prop => prop.GetSetMethod() != null).ToArray(); _columns = new Dictionary <int, COBieColumn>(); // add column info foreach (PropertyInfo propInfo in properties) { object[] attrs = propInfo.GetCustomAttributes(typeof(COBieAttributes), true); if (attrs != null && attrs.Length > 0) { COBieAttributes attr = (COBieAttributes)attrs[0]; List <string> aliases = GetAliases(propInfo); _columns.Add(attr.Order, new COBieColumn(propInfo, attr, aliases)); } } }