title: Usermanager with model inherited from applicationUser
body: <p>I'm early beginner in ASP.NET, and I'm trying to build user system using Identity framework in ASP.NET-MVC project.</p>
  
  <p>I want to have "Admin" user entity inherit from base entity "applicationUser" which is created by default in my models (with my minor changes):</p>
  
  <pre><code>public class ApplicationUser : IdentityUser
  {
      [Required]
      [StringLength(50)]
      [Display(Name = "Last Name")]
      public string LastName { get; set; }
      [Required]
      [StringLength(50, ErrorMessage = "First name cannot be longer than 50 characters.")]
      [Column("FirstName")]
      [Display(Name = "First Name")]
      public string FirstMidName { get; set; }
  
      [Display(Name = "Full Name")]
      public string FullName
      {
          get
          {
              return LastName + ", " + FirstMidName;
          }
      }
  }
  public class Admin: ApplicationUser
  {
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int AdID;
  }
  </code></pre>
  
  <p>I will also add 2 other inheritance from applicationUser, I want to have separeted models for different users to store different information in their database fileds and let all of them login to my site. </p>
  
  <p>In startup I'm trying to initially add admin user using this code (taken somewhere in stackoverflow answers):</p>
  
  <pre><code>        public static async Task CreateRoles(SchoolContext context, IServiceProvider serviceProvider)
          {
  
              var userManager = serviceProvider.GetRequiredService&lt;UserManager&lt;ApplicationUser&gt;&gt;();
              var roleManager = serviceProvider.GetRequiredService&lt;RoleManager&lt;IdentityRole&gt;&gt;();
              // First, Creating User role as each role in User Manager  
              List&lt;IdentityRole&gt; roles = new List&lt;IdentityRole&gt;();
  
              roles.Add(new IdentityRole { Name = "Student", NormalizedName = "STUDENT" });
              roles.Add(new IdentityRole { Name = "ADMIN", NormalizedName = "ADMINISTRATOR" });
              roles.Add(new IdentityRole { Name = "Professor", NormalizedName = "PROFESSOR" });
  
              //Then, the machine added Default User as the Admin user role
              foreach (var role in roles)
              {
                  var roleExit = await roleManager.RoleExistsAsync(role.Name);
                  if (!roleExit)
                  {
                      context.Roles.Add(role);
                      context.SaveChanges();
                  }
              }
  
              await CreateUser(context, userManager);
          }
  
  
          private static async Task CreateUser(SchoolContext context, UserManager&lt;ApplicationUser&gt; userManager)
          {
              var adminUser = await userManager.FindByEmailAsync("alpha@lms.com");
              if (adminUser != null)
              {
                  if (!(await userManager.IsInRoleAsync(adminUser, "ADMINISTRATOR")))
                      await userManager.AddToRoleAsync(adminUser, "ADMINISTRATOR");
              }
              else
              {
                  var newAdmin = new applicationUser()
                  {
                      UserName = "alpha@lms.com",
                      Email = "alpha@lms.com",
                      LastName = "Admin",
                      FirstMidName = "Admin",
  
                  };
                  var result = await userManager.CreateAsync(newAdmin, "password123;");
                  if (!result.Succeeded)
                  {
                      var exceptionText = result.Errors.Aggregate("User Creation Failed
                       - Identity Exception. Errors were: \n\r\n\r", 
                      (current, error) =&gt; current + (" - " + error + "\n\r"));
                      throw new Exception(exceptionText);
                  }
                  await userManager.AddToRoleAsync(newAdmin, "ADMINISTRATOR");
              }
          }
  </code></pre>
  
  <p>But when I try to do it, I receive an exception:
  "Cannot insert the value NULL into column 'Discriminator', table 'aspnet-University; column does not allow nulls. INSERT fails.
  The statement has been terminated."</p>
  
  <p>If I try to change variable Admin type on "new Admin" instead of "new applicationUser", I receive another exception:
  The entity type 'Admin' was not found. Ensure that the entity type has been added to the model.</p>
  
  <p>I know that this question is about basics of identity framework; I do not understand them well yet; I've just began to understand it's prinicples and I don't know how to handle my problem.</p>
  
  <p>My guess that I need to create New UserManager, which will be able to manipulate instances which inherit from basic applicationUser model. I will be happy if you recommend me relevant resources on this topic and help me solve my problem.</p>