Unable to determine the principal end of an association between the types 'EntityFrameworkDatabase.Person' and 'EntityFrameworkDatabase.ApplicationUser'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
I know this questions is answered many times but I think I experience a different problem. ref
I have a relation (0-1 0-1) between User in Identity class and my own class Person. ref, ref
modelBuilder.Entity<ApplicationUser>()
.HasOptional(s => s.Person)
.WithOptionalPrincipal()
.Map(s => s.MapKey("ApplicationUserId"));
modelBuilder.Entity<Person>()
.HasOptional(s => s.ApplicationUser)
.WithOptionalPrincipal()
.Map(s => s.MapKey("PersonId"));
It works fine to migrate and I get two FK. But when I try to login a user I get an exception at
ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password);
Why I get the exception when trying to login but not Updating the db and how to solve the problem?