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; }
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(')'); }