示例#1
0
文件: DbColumn.cs 项目: ppetrov/Cchbc
        public DbColumn(string name, DbColumnType type, bool isNullable = false, bool isPrimaryKey = false, DbForeignKey dbForeignKey = null)
        {
            if (name == null) throw new ArgumentNullException(nameof(name));
            if (type == null) throw new ArgumentNullException(nameof(type));

            this.Name = name;
            this.Type = type;
            this.IsNullable = isNullable;
            this.IsPrimaryKey = isPrimaryKey;
            this.DbForeignKey = dbForeignKey;
        }
示例#2
0
文件: DbScript.cs 项目: ppetrov/Cchbc
 private static void AppendForeignKeyDefinition(StringBuilder buffer, DbForeignKey foreignKey)
 {
     buffer.Append(@"FOREIGN KEY");
     buffer.Append(' ');
     buffer.Append('(');
     buffer.Append('[');
     buffer.Append(foreignKey.Table.ClassName);
     buffer.Append(DbColumn.IdName);
     buffer.Append(']');
     buffer.Append(')');
     buffer.Append(' ');
     buffer.Append(@"REFERENCES");
     buffer.Append(' ');
     buffer.Append('[');
     buffer.Append(foreignKey.Table.Name);
     buffer.Append(']');
     buffer.Append(' ');
     buffer.Append('(');
     buffer.Append('[');
     buffer.Append(DbColumn.IdName);
     buffer.Append(']');
     buffer.Append(')');
 }