public void AddMapping(AttributeDefinition mapping) { if (mapping is EntityAttribute) { var m = mapping as EntityAttribute; //if (!EntityAttributes.Contains(m)) //{ // EntityAttributes.Add(m); //} foreach (var a in EntityAttributes) { if (a.Name.Equals(m.Name) && a.IfcEntityAttribute.Equals(m.IfcEntityAttribute)) { return; } } EntityAttributes.Add(m); } else if (mapping is BbTypeAttribute) { var n = mapping as BbTypeAttribute; foreach (var s in BbTypeAttributes) { if (s.Name.Equals(n.Name)) { return; } } BbTypeAttributes.Add(n); } }
private void LoadAttributes(PropertyInfo property) { AttributeExtractor extractor = new AttributeExtractor(property); if (extractor.UnmappedAttribute != null) { return; } if (extractor.EntityAttribute != null) { EntityAttributes.Add(extractor.EntityAttribute); } if (extractor.FormulaAttribute != null) { FormulaAttributes.Add(extractor.FormulaAttribute); } if (extractor.ColumnAttribute != null) { if (!ColumnAttributes.Contains(extractor.ColumnAttribute)) { ColumnAttributes.Add(extractor.ColumnAttribute); } if (extractor.ForeignKeyAttribute != null) { ColumnForeignKeys[extractor.ColumnAttribute] = extractor.ForeignKeyAttribute; } if (extractor.PrimaryKeyAttribute != null) { ColumnPrimaryKeys[extractor.ColumnAttribute] = extractor.PrimaryKeyAttribute; } } if (!extractor.PropertyIsMapped()) { /* * We should warn the user if they have a property in this class that is not mapped, as * this may have been unintentional. They should used an UnmappedAttribute if they wish to * express that the property was left unmapped on purpose. */ Logger.Warn(MethodBase.GetCurrentMethod(), $"Property {property.Name} of class {entityType.Name} is not mapped explicitly, use an UnmappedAttribute if this was intentional."); } }