我的新手。NET 6/Blazor应用程序同时具有IdentityUser
和AspNetUsers
表。它们有相同的列。我以为我在跟着医生。我的代码中没有作为类的实体。
我通过脚手架创造了身份。为什么我两者都有?
public class AppIdentityContext : IdentityDbContext<IdentityUser>
{
public AppIdentityContext(DbContextOptions<AppIdentityContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}
// Program.cs, what I hope are the relevant bits.
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("VoidHeistDbContextConnection");
// Database and Identity Services
builder.Services.AddDbContext<AppIdentityContext>(options =>
options.UseSqlServer(connectionString));
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<AppIdentityContext>();
builder.Services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
builder.Services.AddHttpContextAccessor();
也许是你干的。
AspNetUsers继承IdentityUser
然而。除了这个问题,不能是其他问题
public class AspnetUsers : IdentityUser
{
}