I have an EF opbject
public class Country
{
[Key]
public string CountryCode { get; set; }
public string CountryName { get; set; }
}
as well as a generic item:
public class Item
{
public int ItemID { get; set; }
public virtual ICollection<Country> AvailableIn { get; set; }
}
the resulting Country
table has the fields:
CountryCode
CountryName
ItemItemID
How do I tell EF that I would like the relation to be build as an ItemAvailableCountry
related table as opposed to modifying the Country table?
EDIT
Per a comment below I've included the relevant migration code if I add just the column in question
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ItemItemID",
table: "Country",
isNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Country_Item_ItemItemID",
table: "Country",
column: "ItemItemID",
principalTable: "Item",
principalColumn: "ItemID");
}
As it may be relevant - this is work in EF7