I'm working with ASP .NET Core 3.0 with Angular project. I see this new ApiAuthorizationDbContext
and I wanted to override the table name and user id (to int) but there is no way I can do it. Does any body know a trick?
This is the class for the context to override the table name but it creates AspNetUser
and User
table. Why doesn't it just create one as usual?
public class ApplicationDbContext : ApiAuthorizationDbContext<AppUser>
{
public ApplicationDbContext(
DbContextOptions options,
IOptions<OperationalStoreOptions> operationalStoreOptions) : base(options, operationalStoreOptions)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<AppUser>(entity => { entity.ToTable(name: "User"); });
modelBuilder.Entity<AppRole>(entity => { entity.ToTable(name: "Role"); });
}
}
Here is my user:
public class AppUser : IdentityUser
{
}
Normaly I override the primary key with AppUser<int>
but it doesn't work because of the ApiAuthorizationDbContext
.
Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…