运行命令 Enable-Migrations
Add-Migration X
X是您想要进行此迁移的任何名称
但是在此迁移之后,如果我创建任何新表,为什么不在db中生成
创建类后,需要在dbcontext中设置表,如下所示:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public DbSet<User> User {get;set;}
}
public class User
{
[key]
public int id {get;set;}
public string name {get;set;}
}
创建迁移并更新数据库
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句