示例#1
0
        private static async Task SeedUserDataAsync(UserManager <User> userManager, ApplicationDbContext context)
        {
            //şifre random oluşturabilirsiniz alttaki yorum satrı kullanarak.
            var defaultPassword = "******";
            //var defaultPassword = StringGenerator.GeneratePassword(8, true, true, true, true);

            var data = await InitializeData.BuildUserList(context);

            var dbData   = userManager.Users.ToList();
            var diffData = data.Where(c => dbData.All(e => e.UserName != c.UserName)).ToList();

            foreach (var user in diffData)
            {
                await userManager.CreateAsync(user, defaultPassword).ConfigureAwait(false);
            }
        }