Beispiel #1
0
        protected virtual void WriteAddForeignKeyReference(string fromTableName, SqlForeignKey foreignKey, StringBuilder writer)
        {
            writer.Append("ALTER TABLE ");
            WriteTableName(fromTableName, writer);
            writer.Append(" ADD CONSTRAINT ");
            WriteColumnName(foreignKey.Name, writer); // NOTE: not a column name
            writer.Append(" FOREIGN KEY (");

            WriteColumnNames(foreignKey.Columns, writer);
            writer.Append(") REFERENCES ");

            WriteTableName(foreignKey.ReferenceTableName, writer);
            writer.Append(" (");

            WriteColumnNames(foreignKey.ReferenceColumns, writer);
            writer.Append(") ");
        }
Beispiel #2
0
 protected virtual void WriteAddForeignKey(string fromTableName, SqlForeignKey foreignKey, StringBuilder writer)
 {
     WriteAddForeignKeyReference(fromTableName, foreignKey, writer);
     WriteAddForeignKeyOn(writer);
 }