1

Is there a way to create an entry (a user) in another Asp.Net Identity Database from another Project other than creating a user in the current Asp.Net Identity? Basically, in my ASP.NET CORE (main) app I want to create some customer users that would be stored in another Identity Database, other than the "ROOT" application - like to say.

I already have an AuthenticationContext defined in ConfigureServices method of the Startup class. That's bound to the userManager and I can easily create users in this context.

However, I want to create user in another Context (which is also an Identity Database) - but used as Identity Context for another application. I want to mention that I have the SQL credentials for that database that I can use in appSettings.json.

Thank you!

Andrei Iovan
  • 107
  • 1
  • 7
  • As you said, you already have SQL credentials, so you only need to add a new dbcontext and some settings on the current project, and then create the corresponding table to it. For specific steps, you can refer to this link: https://stackoverflow.com/questions/43767933/entity-framework-core-using-multiple-dbcontexts – LouraQ May 30 '20 at 08:11
  • Thanks @YongqingYu. But how can I get access to the UserManager of that context? I want to use the UserManager class of that DbContext (In my case, the Authentication context in the "child" app) https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.usermanager-1?view=aspnetcore-3.1... I want to be able to access CreateAsync(TUser) to create users in that AspNet Identity Database. – Andrei Iovan May 30 '20 at 19:55

0 Answers0