I am getting the above error when trying to add migration after add a foreign key using Entity Framework core. I am adding FK in
public class ApplicantDetail
{
[Key]
public int Id { get; set; }
[ForeignKey("GrantProgramFK")]
public GrantProgram GrantProgramId { get; set; }
--------
}
This FK ties to class
public class GrantProgram
{
[Key]
public int Id { get; set; }
-----
}
Any help is appreciated. I tried to remove the entity and run migration again, but failed.
Full error:
The property 'GrantProgramId' cannot be removed from entity type 'EFDataAccessLibrary.Models.ApplicantDetail' because it is being used in the foreign key {'GrantProgramId'} on 'EFDataAccessLibrary.Models.ApplicantDetail'. All containing foreign keys must be removed or redefined before the property can be removed
I found a page, click here, but what does that mean? how to resolve it.