title: EF Core Identity - Applicationuser with one-to-one relationship with another entity returning null
body: <p>I have the following one-to-one relationship with ApplicationUser:</p>
  <pre><code>public class Person
      {
          public Guid PersonId { get; set; }
          public string UserId { get; set; }
          public string FirstName { get; set; }
          public string LastName { get; set; }
          public string Company { get; set; }
          public string Role { get; set; }
          public string Country { get; set; }
          public DateTime CreatedDate { get; set; }
          public bool IsActive { get; set; }
  
          public ApplicationUser User { get; set; }
     }
  
  public class ApplicationUser : IdentityUser
      {
          public Guid PersonId { get; set; }
          public string Provider { get; set; } = &quot;LOCAL&quot;;
          public string ExternalUserId { get; set; }
  
          public Person Person { get; set; }
      }
  </code></pre>
  <p>DbContext:</p>
  <pre><code>public class ApplicationDbContext : IdentityDbContext&lt;ApplicationUser&gt;
      {
          public ApplicationDbContext(DbContextOptions&lt;ApplicationDbContext&gt; opts) : base(opts) { }
  
          public DbSet&lt;Person&gt; Person { get; set; }        
          public DbSet&lt;ApplicationUser&gt; User { get; set; }
  
          protected override void OnModelCreating(ModelBuilder modelBuilder)
          {
              base.OnModelCreating(modelBuilder);
  
              modelBuilder.ApplyConfiguration(new PersonConfiguration());  
                                      
              modelBuilder.Entity&lt;ApplicationUser&gt;(e =&gt; {
                  e.ToTable(name: &quot;User&quot;);
                  e.HasOne(p =&gt; p.Person).WithOne(u =&gt; u.User);
                  //e.HasOne(p =&gt; p.Person).WithOne().HasForeignKey;
              });
              modelBuilder.Entity&lt;IdentityRole&gt;(e =&gt; e.ToTable(name: &quot;Role&quot;));
              modelBuilder.Entity&lt;IdentityUserRole&lt;string&gt;&gt;(e =&gt; e.ToTable(name: &quot;UserRole&quot;));
              modelBuilder.Entity&lt;IdentityUserClaim&lt;string&gt;&gt;(e =&gt; e.ToTable(name: &quot;UserClaim&quot;));
              modelBuilder.Entity&lt;IdentityUserLogin&lt;string&gt;&gt;(e =&gt; e.ToTable(name: &quot;UserLogin&quot;));
              modelBuilder.Entity&lt;IdentityUserToken&lt;string&gt;&gt;(e =&gt; e.ToTable(name: &quot;UserToken&quot;));
              modelBuilder.Entity&lt;IdentityRoleClaim&lt;string&gt;&gt;(e =&gt; e.ToTable(name: &quot;RoleClaim&quot;));           
               
          }
      }
  </code></pre>
  <p>Person entity configuration:</p>
  <pre><code>public class PersonConfiguration : IEntityTypeConfiguration&lt;Person&gt;
      {
          public void Configure(EntityTypeBuilder&lt;Person&gt; builder)
          {
              builder.ToTable(&quot;Person&quot;);
  
              builder.HasOne(u =&gt; u.User)
                     .WithOne(p =&gt; p.Person)
                     .HasForeignKey&lt;Person&gt;(p =&gt; p.UserId);
           }
      }
  </code></pre>
  <p>The problem is when I get the person data from db the related user returns null even using the Include extension.
  FYI: I've tried to load the users from db using the dbcontext but it returns null too.</p>