Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC 3 Reverse Engineer DB Then Switch to Code First

I have used EntitFramework before to do codefirst with MVC; however, I have never reverse engineered an existing database to get my models.

So what I'd like to do is reverse engineer the existing DB then switch to codefirst so that changes made to the models will be reflected in the database automagically by the Entity Framework gods. How would I do this, specifically the reverse engineer then the switch to codefirst? Please have mercy if this is poorly worded or w/e I'm very new to MVC still.

like image 671
Preston Avatar asked Sep 17 '26 11:09

Preston


1 Answers

It basically boils down to using tools to autogenerate the POCO classes that represent your domain, then using those classes as the basis for EF Code First and future migrations.

Here's a msdn article outlining the process

  • Code First to an Existing Database
like image 51
Matt Magpayo Avatar answered Sep 19 '26 02:09

Matt Magpayo