I just recently upgraded my solution/project(s) from .NET Core 1.1 to 2.0, including EntityFramework Core. I am now getting an error I never got from EF Core 1.1.
"Unable to determine the relationship represented by navigation property 'InsurancePolicy.Person' of type 'Person'."
Class/Entity definition is below.
public class InsurancePolicy
{
[Key]
public Guid Id { get; set; }
[ForeignKey( "InsuranceCompanyId" )]
public InsuranceCompany InsuranceCompany { get; set; }
[Required]
public int InsuranceCompanyId { get; set; }
[ForeignKey( "PersonId" )]
public Person Person { get; set; }
[Required]
public Guid PersonId { get; set; }
[ForeignKey( "PolicyHolderId" )]
public Person PolicyHolder { get; set; }
[Required]
public Guid PolicyHolderId { get; set; }
public string GroupId { get; set; }
public string MemberId { get; set; }
}
If I remove the Person/PersonId property, I just get the same error but on a different entity/property. Something else is going on or the way this is done in EF 2.0 changed. This worked fine with EF 1.1 and I was able to run my migration and deploy the database. After the upgrade to 2.0, I cannot make any calls to my DbContext without getting the above error.
Person
class and relevant fluent configuration if any. – Ivan Stoev Aug 17 '17 at 16:40