ASP.NET Core MVC, Identity with multiple databases.
Hello Redditers,
Im trying to implement Microsoft identity in my project, but I noticed that the framework stores all the users in the same database by default, what I'm trying to achieve is creating a new database for every new user, that user will have a "administrator" role and he can create users with "employee" role in the same database, if a new "administrator" account got registered a new database should be created for it and so on.
first thing I thought of is creating a new connection string for every new administrator user, for example :
string ConnectionString = "Server=(localdb)\\mssqllocaldb;Database=DB1" + model.Username;
and I would add this in the AccountController's Register method.
I don't know what to do next, How do I get the Register Method to use the connectionstring I just created for the CreateRoleAsync() and CreateUserAsync() methods instead of the default string in the appsettings.json file.
Any ideas ?
Thank you.
0 comments:
Post a Comment