在我的 ConfigureServices
中我有:
public void ConfigureServices(IServiceCollection services)
{
services.AddEntityFramework()
.AddSqlServer()
.AddDbContext<Context>(options => options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
services.AddIdentity<User, IdentityRole>()
.AddEntityFrameworkStores<Context>()
.AddDefaultTokenProviders();
//...
}
在 Configure
中我有:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
//...
app.UseIdentity();
//...
}
当我 dnx 时。添加迁移 addingIdentity
,我没有在新迁移文件中创建任何身份表(因此 apply
不执行任何操作)。
缺少什么?
最佳答案
原来是因为我的 DbContext 没有继承自 IdentityDbContext...
public sealed class Context : IdentityDbContext<IdentityUser>
关于c# - 未创建身份表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32013427/