コード例 #1
0
        /// <summary>
        ///     Adds an operation to drop a foreign key constraint based on its name.  This is a wrapper for the default DBMigration DropForeignKey.
        /// </summary>
        /// <param name="dependentTable"> The table that contains the foreign key column. Schema name is optional, if no schema is specified then dbo is assumed. </param>
        /// <param name="name"> The name of the foreign key constraint in the database. </param>
        /// <param name="anonymousArguments"> Additional arguments that may be processed by providers. Use anonymous type syntax to specify arguments e.g. 'new { SampleArgument = "MyValue" }'. </param>
        public void DropForeignKey(string dependentTable, string name, object anonymousArguments = null)
        {
            DbMigration dbMigration = new DbMigration();

            dbMigration.DropForeignKey(dependentTable, name, anonymousArguments);
            Sql(dbMigration.GetMigrationSql(SqlConnection));
        }