title: Unable to determine the relationship represented by navigation 'ApplicationUser.XXX' of type 'XXX'
body: <p>I am using .NET Core 6 C# MVC application.</p>
  <p>My classes are below:</p>
  <p>ApplicationUser</p>
  <pre><code>public class ApplicationUser : IdentityUser
      {
          [Required]        
          [Display(Name = &quot;First Name&quot;)]
          public string FirstName { get; set; }
          [Required]       
          [Display(Name = &quot;Last Name&quot;)]
          public string LastName { get; set; }
  
          [Display(Name = &quot;Photo&quot;)]
          public string? ProfilePic { get; set; }       
  
          
          [Display(Name = &quot;Company&quot;)]
          public int? CompanyId { get; set; }            
  
          [ForeignKey(nameof(CompanyId))]
          public virtual Company Company { get; set; }
  
          [NotMapped]
          public string Name
          {
              get
              {
                  return $&quot;{FirstName + &quot; &quot; + LastName}&quot;;
              }
          }
  
          [NotMapped]
          [Display(Name = &quot;Choose Profile Image&quot;)]
          public IFormFile ChooseProfilePic { get; set; }
      }
  </code></pre>
  <p>Company</p>
  <pre><code>public class Company
      {
          [Key]
          public int CompanyId { get; set; }
  
          [Required]
          [Display(Name =&quot;Company Name&quot;)]
          public string Name { get; set; }       
      }
  </code></pre>
  <p>ApplicationDbContext</p>
  <pre><code>public class ApplicationDbContext : IdentityDbContext
      {
          public ApplicationDbContext(DbContextOptions&lt;ApplicationDbContext&gt; options)
              : base(options)
          {
          }        
          public DbSet&lt;ApplicationUser&gt; ApplicationUsers { get; set; }        
          public DbSet&lt;Company&gt; Companies { get; set; }
      }
  </code></pre>
  <p>But when I am going to add migration it shows following error.</p>
  <p><strong>System.InvalidOperationException: Unable to determine the relationship represented by navigation 'ApplicationUser.Company' of type 'Company'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.</strong></p>
  <p>See this <a href="https://i.imgur.com/Z3S3CYZ.jpg" rel="nofollow noreferrer">image</a></p>
  <p>I already specified <strong>[ForeignKey(nameof(CompanyId))]</strong> but still getting this issue.</p>