auto update code first from database model, is it possible?

4.9k Views Asked by At

I have code first classes which are generated from my existing db using ADO.NET Entity Data Model. Now I've added some new tables to the database.

I want to know if its possible to create associated code classes from the new db tables without (re)creating the model again from scratch?

1

There are 1 best solutions below

2
On BEST ANSWER

Yes it is, if you use Reverse Engineer Code First to do so. It will create POCOs exactly like Code-First, but it will do so based completely on the current database. No .edmx file and no T4 template. Just Code-First.

You should know, by the way, that this (along with regular Code-First) are going to be the only ones allowed in EF7. They are getting rid of many things to try to slim it down, and both Model- and Database-First got the ax (at least, for now). This blog post from Microsoft's ADO.NET blog explains that, along with some other features.