コード例 #1
0
ファイル: Table.cs プロジェクト: roufamatic/NMigrations
 /// <summary>
 /// Drops the <see cref="ForeignKeyConstraint"/> with the specified <paramref name="name"/>.
 /// </summary>
 /// <param name="name">The constraint's name.</param>
 /// <returns>The constraint.</returns>
 public ForeignKeyConstraint DropForeignKeyConstraint(string name)
 {
     var c = new ForeignKeyConstraint(this, name, Modifier.Drop);
     Database.MigrationSteps.EnqueueBefore(c, (e => e == this));
     return c;
 }
コード例 #2
0
ファイル: Table.cs プロジェクト: roufamatic/NMigrations
        /// <summary>
        /// Adds a foreign key <see cref="Constraint"/> to this <see cref="Table"/>.
        /// </summary>
        /// <param name="name">The name of the constraint.</param>
        /// <param name="columnNames">The names of the columns.</param>
        /// <param name="relatedTableName">Name of the related table.</param>
        /// <param name="relatedColumnNames">The names of the related columns.</param>
        /// <returns>The foreign key constraint.</returns>
        public ForeignKeyConstraint AddForeignKeyConstraint(string name, string[] columnNames, string relatedTableName, string[] relatedColumnNames)
        {
            var c = new ForeignKeyConstraint(this, name, Modifier.Add)
            {
                ColumnNames = columnNames,
                RelatedTableName = relatedTableName,
                RelatedColumnNames = relatedColumnNames
            };

            Database.MigrationSteps.Enqueue(c);
            return c;
        }