0

I have a class library project and a console app in a solution as two projects. I am trying to enable migrations. But I get an error Object Not set to an instance of object.

Error Message

I have tried multiple solutions including copying the app.config file in the Class Library as seen Here and tried the solution I found Here

 enable-migrations -ContextProjectName RestaurauntData.RestaurauntRepository -StartUpProjectName RestaurauntReviews

Here is project Structure

enter image description here

Here is RestaurauntRepository:

   class RestaurauntRepository : DbContext
    {
        public RestaurauntRepository() : base("name = MyContextDB") { }

App.Config

<connectionStrings>
   <add name = "MyContextDB"
      connectionString = "Data Source =(LocalDb)\MSSQLLocalDB;Initial Catalog = RestaurauntDb;Integrated Security = true"
      providerName = "System.Data.SqlClient"/>
</connectionStrings>
Curious-programmer
  • 772
  • 3
  • 13
  • 31

0 Answers0