由于密码已加密,如何使用Seed方法初始化用户。
答案 0 :(得分:1)
您可以初始化Usermanager对象并创建用户。
protected override void Seed(ApplicationDbContext context)
{
var userStore = new UserStore<ApplicationUser>(context);
var userManager = new UserManager<ApplicationUser>(userStore);
var admin = new ApplicationUser { UserName = "your username", Email = "your email" };
userManager.Create(admin, "your password");
}