Exemplo n.º 1
0
        protected override DbCommand OnBuildCreateRelationCommand(ICreateRelation Query)
        {
            SqlCommand    command;
            StringBuilder sql;

            sql = new StringBuilder();
            sql.Append("ALTER TABLE ");
            sql.Append(OnFormatTableName(Query.Table));
            sql.Append($" WITH CHECK ADD CONSTRAINT [FK_{Query.ForeignColumn.Table.Name}_{Query.ForeignColumn.Name}_{Query.PrimaryColumn.Table.Name}]");
            sql.Append($" FOREIGN KEY ({OnFormatColumnName(Query.ForeignColumn, false)})");
            sql.Append($" REFERENCES [{Query.PrimaryColumn.Table.Name}] ({OnFormatColumnName(Query.PrimaryColumn, false)})");


            command = new SqlCommand(sql.ToString());

            return(command);
        }
Exemplo n.º 2
0
 protected abstract DbCommand OnBuildCreateRelationCommand(ICreateRelation Query);