When I create user by Register action whe application is running the application user gets SecurityStamp. When I add user by:
if (!context.Users.Any()) {
System.Diagnostics.Debug.WriteLine("INSIDE");
var hasher = new PasswordHasher();
try {
var users = new List<ApplicationUser> {
new ApplicationUser { PasswordHash = hasher.HashPassword("TestPass44!"), Email = "[email protected]", UserName = "[email protected]" },
new ApplicationUser { PasswordHash = hasher.HashPassword("TestPass44!"), Email = "[email protected]", UserName = "[email protected]" }
};
users.ForEach(user => context.Users.AddOrUpdate(user));
context.SaveChanges();
} catch (DbEntityValidationException e) {
System.Diagnostics.Debug.WriteLine("EXC: ");
foreach (DbEntityValidationResult result in e.EntityValidationErrors) {
foreach (DbValidationError error in result.ValidationErrors) {
System.Diagnostics.Debug.WriteLine(error.ErrorMessage);
}
}
}
}
user doesn't get security stamp:

and then when I want to login I get:

Question: How to generate SecurityStamp for user?

UserManager.CreateAsync();instead?