Essentials and First Code Development

Microsoft releases Entity Framework 4.0 and developers can create Code First Development in it. This is great, and thanks to Microsoft.

I have one understanding of the first code development. I worked on the Entity Framework in ASP.NET 3.5 SP1 and Visual Studio 2008 SP1. In this case, we create a database schema, and from it we create an entity data model. This means that we are creating our class model from the database. I think this is called first data mining.

But when we create the Entity data model in Entity Framework 3.5 SP1, there are two options. First, Generate is created from the existing database, and the other creates an empty model. Suppose I create an empty model and then map it to a database. Therefore, we first develop class models without thinking about the database schema, and then map it to the database. My trust is that it is called the first release of the code? Then why do community people and books say that “it is impossible to implement the first code development in Entity Framework 3.5 SP1”?

To solve my problem, I need your help. Therefore, please reply to this message.

Thanks.

+7
source share
3 answers

First code is available since Entity Framework 4.x. Thus, you cannot create a database from your code model in 3.5 SP1.

There are basically 3 types:

  • Database first (database already exists, you create edmx from this using the Wizard)
  • Model first (you create a database model using the constructor, Entity Framework gerenates from the database)
  • Code first (your code, Entity Framework creates the database)

Additional Information: Code Development Using Entity Framework 4

+5
source

This is actually called the "model first." Although the default designer in Visual Studio directly turns your model into code, it’s really just the “conceptual model” you see in the designer. Where you define properties and relationships, the constructor uses the Code Generation Strategy, which creates .NET classes for you.

The "new code-first" approach allows you to create .NET classes directly, rather than defining what the "conceptual model" looks like.

+3
source

When you create an empty model and then try to model a domain, it is called Model First . You can visually design an object model in the designer. Then it will generate relationships for you.

There is no visual designer in the code at first. You must encode the relationship yourself. Therefore, it is called Code First.
Take a look at this in more detail.

Code One vs First Model / Database

+1
source

All Articles