C# – Enable Migrations with No Context type was found in the assembly ‘

Description

When you start to work on the project with DATA in C#, using EF, you probably will see the same issue like this:

To solve it, create the DBContext class

In the Models foder, create the class MyDbContext inherting from DbContext.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Entity;
 
namespace Vidly.Models
{
    public class MyDbContext : DbContext
    {
        public MyDbContext()
        {
 
        }
    }
}

And then, run the command line again:

enable-migrations

You will get the print like this below:

Checking if the context targets an existing database...
Code First Migrations enable for project Vidly.