Есть 2 класса, хочу соединить связью один-к-одному
public class Profession : Model
{
public int Id { get; set; }
public Test MainTest { get; set; }
...
}
public class Test
{
[Key]
[ForeignKey("Profession")]
public int Id { get; set; }
...
public Profession Profession { get; set; }
}
Выдает ошибку при компиляции:
"The ForeignKeyAttribute on property 'Id' on type 'Test' is not valid. The navigation property 'Profession' was not found on the dependent type 'Test'. The Name value should be a valid navigation property name."