title: How to add a column in .Net Identity ApplicationUser model to point to a foreign model?
body: <p>I am trying to use Asp.Net MVC framework with the built in Identity system that is provided by Microsoft out-of-the-box.</p>
  
  <p>However, I need to capture more data about the user. </p>
  
  <p>To minimize the changes to the Identity classes, I need created a new model called "User" where I put in all of my custom attributes. Then I added an attribute called "SystemId" which is a foreign key to the <code>ApplicationUser</code> model.</p>
  
  <p>Here is what I have done</p>
  
  <p>Here is my custom <code>User</code> model</p>
  
  <pre><code>    [Required]
      [MaxLength(128)]
      [ForeignKey("Id")]
      public string SystemId { get; set; }
  
  
      [MaxLength(50)]
      public string FirstName { get; set; }
  
      [MaxLength(50)]
      public string MiddleName { get; set; }
  
      [MaxLength(50)]
      public string LastName { get; set; }
  
      [MaxLength(250)]
      public string Email { get; set; }
  
      [MaxLength(50)]
      [Index("IX_Username", 1, IsUnique = true)]
      public string Username { get; set; }
  
      [ForeignKey("Role")]
      public int RoleId { get; set; }
  
  
      [ForeignKey("Client")]
      public int CurrentClientId { get; set; }
  
      [ForeignKey("Campaign")]
      public int? CurrentCampaignId { get; set; }
  
      public string Status { get; set; }
  
      public virtual Role Role { get; set; }
  
      public virtual Client Client { get; set; }
  
      public virtual Campaign Campaign { get; set; }
  
      public virtual ApplicationUser ApplicationUser { get; set; }
  
      public virtual List&lt;UserToPrivilege&gt; UserToPrivileges { get; set; } 
  
      public User()
      {
          DateTime UtcNow = DateTime.UtcNow;
  
          Status = "active";
  
          MiddleName = null;
  
          UserToPrivileges = new List&lt;UserToPrivilege&gt;();
  
          CreatedAt = UtcNow;
  
          LastUpdatedAt = UtcNow;
      }
  
  }
  </code></pre>
  
  <p>Then in the <code>IdentityModel</code> class I changed my <code>ApplicationUser</code> class to the following</p>
  
  <pre><code>public class ApplicationUser : IdentityUser
  {
      [ForeignKey("User")]
      public int UserId { get; set; }
  
      public virtual User User { get; set; }
  
      public async Task&lt;ClaimsIdentity&gt; GenerateUserIdentityAsync(UserManager&lt;ApplicationUser&gt; manager)
      {
          // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
          var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
          // Add custom user claims here
          return userIdentity;
      }
  }
  </code></pre>
  
  <p>but when I try to create my migration like so</p>
  
  <pre><code>Add-Migration InitialCreate -Force
  </code></pre>
  
  <p>I get the following error</p>
  
  <blockquote>
    <p>The property 'Id' cannot be configured as a navigation property. The
    property must be a valid entity type and the property should have a
    non-abstract getter and setter. For collection properties the type
    must implement ICollection where T is a valid entity type.</p>
  </blockquote>
  
  <p>What am I doing wrong? How can I link custom <code>User</code> model to the <code>ApplicationUser</code> model in belong to relation?</p>