Hurry Up, Ends March 14!
Open Closed

Query Related to Bulk User Insert #7048


User avatar
0
Exceego created
  • ABP Framework version: v7.3.2
  • UI Type: MVC
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Our requirement is to insert bulk users. We are using IdentityRepository InsertManyAsync to insert bulk users, it is working good except create password for the users because, we can not assign PasswordHash to IdentityUser entity as it's set parameter is protected and we don't want to use UserManager to create users.

Is there any alternate way to insert bulk users Please advise.


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can inject the IPasswordHasher<IdentityUser> service. Then use ObjectHelper to set the protected property.

    ObjectHelper.TrySetProperty(identityUser, x => x.PasswordHash, () => your_password);

    https://github.com/dotnet/aspnetcore/blob/main/src/Identity/Extensions.Core/src/IPasswordHasher.cs

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 07, 2025, 04:57