Not long ago, I saw the news that Microsoft was preparing to open-source the Entity Framework. As soon as it was open-source, more students will definitely join the learning Entity Framework Team, therefore, I will write down some of my understanding of Entity Framework. I hope you can discuss it together. More importantly, you can also become more familiar with the EF Framework through this process, let's talk about the outline first.
Content outline of this series
- Code First --- Hello World
- Conventions and configurations
- Entity Framework & Database
Code First, past and present
. NET 3.5 and Visual Studio 2008 bring the first iteration version of Entity framework, and bring reverse engineering capabilities to developers, you can use the visual studio designer to map a DataBase to a domain model to view the DataBase and user-defined DataBase model-DataBase-First mode. in. entity framework in NET4 and visual studio2010 has the second version: Entity framework 4, in this version, we can use the visual studio designer to create a domain model based on the EDMX file and synchronize it to the database, this allows developers to focus on the domain Model rather than the database design-Model First Model. At the same time, another mode Code First is introduced. The defined domain model is described through Code files instead of EDMX. In Code First, you can define the POCO file by yourself, instead of using the designer or other.
When to select Code first
The three modes are one of the ways to create the Entity Data Model, and the method for executing the model creation is the same. Therefore, you can choose to use only the one that looks at your preferences and project scenarios.
I probably listed the scenarios that are more suitable for Code First. Of course, this is not absolute. For example, I have a special liking for Code first.