EF DbContext from Database vs. EF power tools reverse engineer from database. What is difference ?

717 views Asked by At

I am using an existing database and my normal method is to add a new Entity Data Model and point it to the existing database. If I was to use the EF power tools and reverse engineer to make it 'code first' style what is the advantage of this ?

Both are classes that inherit from DbContext right ? So can someone explain to me what an advantage might be working with the code base over time if I was to use the EF power tools reverse engineer tool instead ?

1

There are 1 answers

2
bricelam On BEST ANSWER

Code First to an existing database generates your model (at runtime) from your C# classes. Database First stores the model inside of an .edmx file and generates your classes (at design time).

The video Entity Framework Development Workflows gives a good overview. Ultimately, it comes down to whether you want to maintain your model using a designer surface or using C# classes.

It is also worth mentioning that, if you want to use Code First Migrations, you have to use Code First since it currently doesn't work with Database First.