troubleshooting Question

seeding data into ASP.Core Identity tables

Avatar of maqskywalker
maqskywalker asked on
ASP.NET* Entity Framework Core* ASP.NET CoreMicrosoft Visual Studio
4 Comments1 Solution12 ViewsLast Modified:

I have a ASP.NET Core 3.1 MVC application using ASP Identity for Authentication and Authorization that I created using Visual Studio 2019

I'm using the Northwind SQL Server sample database.

So in my app I created a Migration for the ASP.NET Core Identity tables and then ran the Update-Database command which created these ASP.NET Core Identity tables in my database.

[Northwind].[dbo].[AspNetRoleClaims]
[Northwind].[dbo].[AspNetRoles]  
[Northwind].[dbo].[AspNetUserClaims]
[Northwind].[dbo].[AspNetUserLogins]  
[Northwind].[dbo].[AspNetUserRoles]  
[Northwind].[dbo].[AspNetUsers]
[Northwind].[dbo].[AspNetUserTokens]

I already know how to create new roles and users by using a form on one of my views.
Then on another view I am able to assign roles to a user.

Now I'm trying to learn how to seed users into the ASP.NET Core Identity tables mentioned above.

On the internet I've searched "asp.net core identity seeding data".

I found lots of good examples on seeding data into a regular table. I already know how to do that.

But I didn't really find a good example on seeding data users and roles into the ASP.NET Core Identity tables.


The difference I have seen is that when seeding data into ASP.NET Core Identity tables, I have to hash the password and other few columns.

Does anyone have a reference to a good article or video on seeding data into ASP.Core Identity tables in a ASP.NET Core 3.0 MVC or higher application?


ASKER CERTIFIED SOLUTION
Chinmay Patel
Chief Technology Ninja
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros