Reputation: 626
My Project has 3 tiers:
I'm using MVC 4 with Entity Framework 5 and Code First Approach.
So It's possible to enable POCOs Migrations on Project.UI?
I Tried run:
enable-migrations Project.Data.MyDbContext
But receive the message:
The context type 'Project.Data.MyDbContext' was not found in the assembly 'Project.UI'.
Upvotes: 0
Views: 2249
Reputation: 2221
I would suggest that you create a separate project within your solution for data seeding. You can then include a reference to your Project.Data.DLL within the seeding project and run the migrations from there (which would be fitting).
Upvotes: 0
Reputation: 18
You can also include the Project.Data.DLL to the Project.ui this is the approach we have taken. We have also wrapped views into a similar DLL for use across multiple projects
Upvotes: 0
Reputation: 34248
You need to make sure you are running enable-migrations on the project containing your DBContext so you cant run it on the UI project (otherwise it needs to be a relative path to the project from the currently selected one eg. ./project.data)
Set default project to Project.Data
then run:
enable-migrations
Upvotes: 4