Dashing.Engine.Dialects.SqlDialectBase.CreateForeignKey C# (CSharp) Method

CreateForeignKey() public method

public CreateForeignKey ( ForeignKey foreignKey ) : string
foreignKey Dashing.Configuration.ForeignKey
return string
        public virtual string CreateForeignKey(ForeignKey foreignKey) {
            var sql = new StringBuilder();
            sql.Append("alter table ");
            this.AppendQuotedTableName(sql, foreignKey.ChildColumn.Map);
            sql.Append(" add constraint ").Append(foreignKey.Name).Append(" foreign key (");
            this.AppendQuotedName(sql, foreignKey.ChildColumn.DbName);
            sql.Append(") references ");
            this.AppendQuotedTableName(sql, foreignKey.ParentMap);
            sql.Append("(");
            this.AppendQuotedName(sql, foreignKey.ParentMap.PrimaryKey.DbName);
            sql.Append(")");
            return sql.ToString();
        }