Codefirst migration error in mvc
I want to use codefirst dataaccess in my MVC Application.I have separated model classes and dbcontext in separate project in same application
My main application name is EFCodeFirstHarshaTest
model classes in Company1.DomainModels , which contains 3 classes
DbContext name is Company1.DomainModels following is the code for dbcontext
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using Company1.DomainModels;
namespace Company1.DataLayer
{
public class Company1DbContext : DbContext
{
public Company1DbContext() : base("MyConnectionString")
{
// Database.SetInitializer(new MigrateDatabaseToLatestVersion<Company1DbContext, Configuration>());
}
public DbSet<Product> Products { get; set; }
public DbSet<Brand> Brands { get; set; }
public DbSet<Category> Categories { get; set; }
}
}
next I have selecte nuget packagemanager console
i have entered
PM> enable-migrations -ContextTypeName Company1.DataLayer.Company1DbContext
iam getting following result
The context type 'Company1.DataLayer.Company1DbContext' was not found in the assembly 'EFCodeFirstHarshaTest'
how to solve this
Regards
Baiju