I have .net core application which uses ef core 2.2 code first model , When i run
Add-migration
it always updates "ConcurrencyStamp", "PasswordHash"
column values in "AspNetUsers"
table.
Auto generated UP
method content is
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: new Guid("b0bea27d-5eae-4836-8f85-8bf8f1aed8d5"),
columns: new[] { "ConcurrencyStamp", "PasswordHash" },
values: new object[] { "c599b745-8e24-438b-bd62-8264102ac960", "AQAAAAEAACcQAAAAEHjqRSJuPQtzpQR7L7hUNo3vFM8P9dhHkiXQjYRpdgS1Z9I9TXQ2XwhM9CQiE0oVyg==" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: new Guid("b0bea27d-5eae-4836-8f85-8bf8f1aed8d6"),
columns: new[] { "ConcurrencyStamp", "PasswordHash" },
values: new object[] { "bdbc0bcf-6eaa-489b-b2a2-9c1742a38bf4", "AQAAAAEAACcQAAAAEBpVzPQl74gxL+V93biLDmn4oKNJSZZ5VDUpwSQ/S8h+itGvGbScqG78Wi35bmN4dQ==" });
My OnModelCreating method is as follows
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfigurations(
typeof(SampleDBContext).Assembly,
typeof(IEntityTypeConfiguration<>));
DatabaseSeeder.Seed(modelBuilder);
}
Inside seed method i call to a method to seed application user.
private static void SeedApplicationUser(ModelBuilder modelBuilder)
{
var hasher = new PasswordHasher<ApplicationUser>();
var admin = new ApplicationUser
{
Id = Guid.Parse("b0bea27d-5eae-4836-8f85-8bf8f1aed8d4"),
RoleType = RoleTypes.Admin,
Email = "admin@gmail.io",
NormalizedEmail = "ADMIN@GMAIL.IO",
EmailConfirmed = true,
UserName = "admin",
NormalizedUserName = "ADMIN",
};
var user1 = new ApplicationUser
{
Id = Guid.Parse("b0bea27d-5eae-4836-8f85-8bf8f1aed8d5"),
RoleType = RoleTypes.User,
Email = "user1@gmail.io",
NormalizedEmail = "USER1@GMAIL.IO",
EmailConfirmed = true,
UserName = "user1",
AccessFailedCount = 0,
NormalizedUserName = "USER1",
};
var user2 = new ApplicationUser
{
Id = Guid.Parse("b0bea27d-5eae-4836-8f85-8bf8f1aed8d6"),
RoleType = RoleTypes.User,
Email = "user2@gmail.io",
NormalizedEmail = "USER2@GMAIL.IO",
EmailConfirmed = true,
UserName = "user2",
AccessFailedCount = 0,
NormalizedUserName = "USER2",
};
admin.PasswordHash = hasher.HashPassword(admin, "admin@23");
user1.PasswordHash = hasher.HashPassword(user1, "user1@23");
user2.PasswordHash = hasher.HashPassword(user2, "user2@23");
modelBuilder.Entity<ApplicationUser>()
.HasData(admin, user1, user2);
}
Is this normal behavior or im i missing something ?
if anyone need more details , comment. i have no idea what to provide.
thanks,