1

I'm trying to add Identity to an existing and working MVC project.

When used this command Add-Migration CreateIdentitySchema I got error message: 'More than one DbContext was found. Specify which one to use. Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands.' and I chose the existing DB context that I have previously created for the main functionality of the application and now it shows 'There is already an object named 'ExpenseReport' in the database.' so it's trying to recreate my initial model.

Should I have a separate DB Context for Identity and if yes how to connect user to data from the other context?

Gryu
  • 2,102
  • 2
  • 16
  • 29
bgdean
  • 11
  • 2

1 Answers1

0

So, i think you can use several DbContexts with different connections (just need to write it in your Startup class) or you need to use pattern "DbContext Factory". You can read more here .

Hope it will help you.