In this chapter, let us focus on building models with the Designer or Database First or just using Code First. Following are some guidelines which will help you decide which modeling workflow to choose.
We have already seen examples of Code First modeling, Database First modeling and a Model First modeling workflow.
The Database First and Model First workflows used the Designer but one starts with the database to create a model and the other starts at the model to create a database.
For those developers who do not want to use Visual Designer plus code generation, Entity Framework has a completely different workflow called Code First.
The typical workflow for Code First is great for brand new applications where you don't even have a database. You define your classes and code and then let Code First figure out what your database should look like.
It is also possible to start Code First with a database and that makes Code First a bit of a contradiction. But there's a tool to let you reverse engineer a database into classes which is a great way to get a head start on the coding.
Given these options, let's look at the Decision Tree.
If you prefer to work with a Visual Designer in generated code, then you'll want to choose one of the workflows that involves EF Designer. If your database already exists, then Database First is your path.
If you want to use a Visual Designer on a brand new project without a database, then you'll want to use Model First.
If you just want to work with code and not a Designer, then Code First is probably for you along with the option of using the tool that reverse engineers the database into classes.
If you have existing classes, then your best bet is to use them with Code First.