I using from asp.net core 2.2 Identity for my user managment system.
I need to have several types of users ... for example, warehouse user and Application user
I create a base class that inherits from idntity user class => IdentityUser<long>
public class BaseApplicationUser : IdentityUser<long>
{
public string FirstName { set; get; }
public string LastName { set; get; }
.
.
.
}
and warehouse user and store user Inherit from BaseApplicationUser to create diffrent users.
public class ApplicationUser:BaseApplicationUser
{
.
.
}
public class WarehouseApplicationUser:BaseApplicationUser
{
.
.
}
I want to have just one table for all of them => "AspNetUsers" On OnModelCreating added this code :
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<ApplicationUser>();
builder.Entity<WarehouseApplicationUser>();
}
and in DbSets in Context :
public DbSet<ApplicationRole> ApplicationRole { get; set; }
public DbSet<ApplicationUser> ApplicationUsers { get; set; }
public DbSet<WarehouseApplicationRole> WarehouseApplicationRole { get; set; }
public DbSet<WarehouseApplicationUser> WarehouseApplicationUsers { get; set; }
}
** I need and Create Separately Role class for which user like "ApplicationRole" and "WarehouseApplicationUsers"
Whats is Problem? 1- How to create different users in asp.net core Identity ? ( best way ) 2- another problem is => when I add filed to "ApplicationUser" this field added to "AspNetUsers" with success but when add field to "WarehouseApplicationUsers" EF Core Add New Tables With names "WarehouseApplicationUsers" and "WarehouseApplicationRole" and "WarehouseApplicationUserRole" then add field in "WarehouseApplicationUsers" table... what is this !!!
Finally, how do I inherit and build a hierarchy of different users? Thankful
