Estou tentando criar uma primary key composta, até tudo bem. Com isso preciso fazer uma foreign key composta.
Tenho mais ou menos o seguinte cenário (é um cenário hipotético mas reflete o que preciso e meu erro):
public class Keys {
[Key, Column(Order = 0)]
public int Key_1 { get; set; }
[Key, Column(Order = 1)]
public int Key_2 { get; set; }
// order is important here as defined in "KeyAuthorities" table
[ForeignKey("KeyAuthorities", Column(Order = 0)]
public int KeyAuthorities_Key_1 { get; set; }
[ForeignKey("KeyAuthorities", Column(Order = 1)]
public int KeyAuthorities_Key_2 { get; set; }
}
public class KeyAuthorities {
[Key, Column(Order = 0)]
public int KeyAuthorities_Key_1 { get; set; }
[Key, Column(Order = 1)]
public int KeyAuthorities_Key_2 { get; set; }
}
The ForeignKeyAttribute on property 'KeyAuthorities' on type 'PortalAdmCC.Models.Keys' is not valid. The foreign key name 'KeyAuthorities' was not found on the dependent type 'PortalAdmCC.Models.Keys'. The Name value should be a comma separated list of foreign key property names.
O que esse erro quer dizer?