title: How to seed a user at initializer with Identity asp.net mvc 5?
body: <p>While working with database initializer, I can save a role and a user at my development database, but the password never works. I can not login.</p>
  
  <p>This is the code, what is it lacking?</p>
  
  <pre><code>public class DevelopmentDbInitializer : System.Data.Entity. DropCreateDatabaseIfModelChanges&lt;ApplicationDbContext&gt;
  {
      protected override void Seed(ApplicationDbContext context)
          {
              string password = "1_Changeme";
              string administrator = "Administrator";
              string adminEmail = "admin@office.com";
  
              // Role
              if (!context.Roles.Any(role =&gt; role.Name == Utils.Constants.ROLE_ADMINISTRATOR))
              {
                  var roleStore = new RoleStore&lt;IdentityRole&gt;(context);
                  var roleManager = new RoleManager&lt;IdentityRole&gt;(roleStore);
                  var adminRole = new IdentityRole { Name = Utils.Constants.ROLE_ADMINISTRATOR };
                  roleManager.Create(adminRole);
              }
  
              // User
              if (!context.Users.Any(user =&gt; user.UserName == administrator))
              {
                  var userStore = new UserStore&lt;ApplicationUser&gt;(context);
                  var userManager = new UserManager&lt;ApplicationUser&gt;(userStore);
                  var adminUser = new ApplicationUser { Email = adminEmail, UserName = administrator, PhoneNumber = "7144251556" };
                  userManager.Create(adminUser, password);
                  userManager.AddToRole(adminUser.Id, Utils.Constants.ROLE_ADMINISTRATOR);
              }
  
          }
  }
  </code></pre>
  
  <p>User is at database, but there is something with the password. I also use a variant with hasher and is the same story. This code seems to work on older versions of Visual Studio an Entity.</p>
  
  <p>Anything changed last year with VS and its libraries?</p>
  
  <p>Thanks in advance. </p>
  
  <p>Using Visual Studio 2015. I suppose it is Identity 2.0. Code came from different places at stackoverflow...</p>