コード例 #1
0
 public IEnumerable<string> ToSql(IProvider provider, IRuntimeContext context)
 {
     if (_columnNames.Count == 0)
     {
         throw new InvalidCommandException("At least one column must be added to the AddForeignKeyTo command.");
     }
     string effectiveConstraintName = GetEffectiveConstraintName();
     return provider.AddForeignKey(Parent.TableName, _referencedTableName, _columnNames.Select(p => new ColumnReference(p.Key, p.Value)), effectiveConstraintName, CascadeOnDelete);
 }
コード例 #2
0
        public IEnumerable <string> ToSql(IProvider provider, IMigrationContext context)
        {
            if (_columnNames.Count == 0)
            {
                throw new InvalidCommandException("At least one column must be added to the AddForeignKeyTo command.");
            }
            string effectiveConstraintName = GetEffectiveConstraintName();

            return(provider.AddForeignKey(new TableName(Parent.TableName, Parent.Schema ?? context.GetDefaultSchema()), new TableName(_referencedTableName, ReferencedTableSchema ?? Parent.Schema ?? context.GetDefaultSchema()), _columnNames.Select(p => new ColumnReference(p.Key, p.Value)), effectiveConstraintName, CascadeOnDelete));
        }
コード例 #3
0
        public IEnumerable <string> ToSql(IProvider provider, IRuntimeContext context)
        {
            if (_columnNames.Count == 0)
            {
                throw new InvalidCommandException("At least one column must be added to the AddForeignKeyTo command.");
            }
            string effectiveConstraintName = GetEffectiveConstraintName();

            return(provider.AddForeignKey(Parent.TableName, _referencedTableName, _columnNames.Select(p => new ColumnReference(p.Key, p.Value)), effectiveConstraintName));
        }