private Field CreateField(PropertyInfo prop, FieldAttribute fieldAttribute) { Field field; if (fieldAttribute.IsPrimaryKey) { PrimaryKey = PrimaryKey.Create(this, prop, fieldAttribute as PrimaryKeyAttribute); field = PrimaryKey; } else if (fieldAttribute.IsForeignKey) { var foreignKey = ForeignKey.Create(_entities, this, prop, fieldAttribute as ForeignKeyAttribute); ForeignKeys.Add(foreignKey); field = foreignKey; } else { field = Field.Create(this, prop, fieldAttribute); } Fields.Add(field); return(field); }