How to convert EF code to the first database first?

I want to convert my first code to a database first. Is there an automated way or should I just delete entities and context code and create a model from the created database?

+3
source share
2 answers

It is not possible to convert your code classes to database classes. Creating a model from the database will create an entirely new set of classes, regardless of the availability of your code classes.

However, you may not want to immediately remove your first code classes. The original entity database model creates partial classes for all entity objects. If your code classes have any business logic (something other than simple old properties), you can declare them as partial, remove properties, and maintain business logic. Essentially, you allow EF to generate properties in the * Designer.cs file, while you define the business logic in your .cs files.

+1
source

Appears Entity Framework Power Tools supports the "Reverse Engineer Code First" feature. You can download here .

+3
source

All Articles