/// <summary> /// Adds an operation to create a new foreign key constraint. /// attacks etc. /// </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="dependentColumns">The foreign key columns.</param> /// <param name="principalTable">The table that contains the column this foreign key references. Schema name is /// optional, if no schema is specified then dbo is assumed.</param> /// <param name="principalColumns">The columns this foreign key references. If no value is supplied the primary key /// of the principal table will be referenced.</param> /// <param name="cascadeDelete">A value indicating if cascade delete should be configured for the foreign key /// relationship. If no value is supplied, cascade delete will be off.</param> /// <param name="name">The name of the foreign key constraint in the database. If no value is supplied /// a unique name will be generated.</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 AddForeignKey(string dependentTable, string[] dependentColumns, string principalTable, string[] principalColumns = null, bool cascadeDelete = false, string name = null, object anonymousArguments = null) { DbMigration dbMigration = new DbMigration(); dbMigration.AddForeignKey(dependentTable, dependentColumns, principalTable, principalColumns, cascadeDelete, name, anonymousArguments); Sql(dbMigration.GetMigrationSql(SqlConnection)); }