Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable migrations in class library project

How to enable migrations in a class library project?

I'm building a project using Code First EF5. I want to separate the data and the mvc web project by adding a class library project.

Right now the migrations is enabled in the mvc web project. I'll have to remove that too.

Any ideas?

like image 295
Yustme Avatar asked Apr 30 '13 15:04

Yustme


1 Answers

You should be able to do it using the "Package Manager Console" (View > Other Windows > Package Manager Console).

Ensure the default project drop down is set to the class library project you want to enable migrations for, ensure you have a reference to the Entity Framework DLL in the project, and then run enable-migrations.

To run update-database commands etc you'll need an app.config file that includes a connection string for each of your data contexts.

like image 68
greg84 Avatar answered Sep 24 '22 05:09

greg84