I have a program where I read a CSV file of email addresses and user data, and bring it into a C# console line application, and write each one into the AspNetUser table (assuming it passes validation).
I can write in a new user via the following code:-
AspNetUser user = new AspNetUser();
user.Id = Guid.NewGuid().ToString();
user.UserName = username;
// More Code
db.AspNetUsers.Add(user);
db.SaveChanges();
How can I from here, assign them to a role, so adding a record in the AspNetUsersRole table? The table is not accessible through LINQ? I don't seem to have access to UserManager or ApplicationUser in the console line application?
Thanks in advance!
UserManagerandRoleManagerclasses to manage your users/roles.