void BuildAnchorModels(TypeDefinition db, PropertyDefinition dbProperty, List <ForeignKeySet> foreignKeyProps) { var anchorName = Anchor.GetName(dbProperty.Name); var entityType = dbProperty.GetFirstGenericArgument().Resolve(); var keyAttributeProp = entityType.FindPropertyByCustomAttribute(nameof(KeyAttribute)) ?? throw new KeyMissingException(anchorName); var ignoredProps = new List <PropertyDefinition> { keyAttributeProp }; var anchorEntityType = BuildAnchorEntity(db, anchorName, entityType); FindForeignKeys(entityType, dbProperty, foreignKeyProps, ignoredProps); entityType.Properties.Except(ignoredProps, _propComparer).ToList() .ForEach(entityProperty => BuildAttributeEntity(db, dbProperty, anchorEntityType, entityProperty)); }