I have 4 projects :
Toombu.Entities : all models are there
Toombu.DataAccess: Mapping, Repository and ToombuContext
Toombu.Logique : Logic of my application
Toombu.Web : MVC 4 application. With all others DLL.
I tried to enable migration in Toombu.Web but i had this error :
No context type was found in the assembly
How can I enable migration ?
Adding a class which inherits
DbContext
resolved my problem:Change the default project and choose the startup project from dropdown:
My problem was link----> problem1
I solved that problem with one simple command line
After that, i needed to face with one more problem, something like:
I solve this really easy. This "No context" that mean you need to create class in "Model" folder in your app with suffix like DbContext ... like this MyDbContext. There you need to include some library using System.Data.Entity;
After that,i just needed this command line:
And if you have Multiple project in one solution than you have to use below commands:-