Tag Archives: entity framework

Development

Moving Entity Framework migrations to another project

This happens to me quite often, because of the way I tend to work with new projects: I’ve created a new web application, got it up and running and set up my initial code first migration, start working on the model (maybe another few migrations for new tables etc) and then realise that I want to move the database to a separate “data layer” project AFTER I’ve already started running the migrations.

So I move my Entity Framework DB context, my model POCOs and my Migrations folder out to the new project, and update all the namespaces to be right (e.g. “SiteName.Data” rather than “SiteName.Web”).

Read More