Unable to create an object of type ‘DbContext’

If you are using the CLI,

When you have a solution with 2 projects API/WebApp and a DataAcess project you can pass in the options on the command line.

My_Solution
       |DataAccess_Project
       |-- DbContext.cs
       |WebApp_Project
       |-- Startup.cs

Change into the solution directory

CD My_Solution

dotnet ef migrations add InitialCreate --project DataAccess_Project --startup-project WebApp_Project

dotnet ef database update --project DataAccess_Project --startup-project WebApp_Project

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)