コード例 #1
0
ファイル: EntityInfo.cs プロジェクト: sGeeK44/OpenNet
        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);
        }