Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core 2.0 using two databases, one for authentication one for data [closed]

I already have a database which several of my projects use for authentication and I have a database specific for my current project. I'm currently working on an ASP.NET Core 2.0 project with EF Core. Now I'm wondering if it's possible to add authentication to my current project in a way that it will use the existing authentication database but still use it's own database for storing data.

like image 263
Jeroen Avatar asked Aug 10 '26 00:08

Jeroen


1 Answers

  1. You should implement two dbContext.
  2. Register two contexts in ConfigureServices method using connection string keys from config-file), or you can specify connection strings directly inside the method as arguments.
  3. Then you can resolve nessesary contexts in constructors.
like image 83
Anton Gorbunov Avatar answered Aug 13 '26 05:08

Anton Gorbunov